⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exmp2_11.m

📁 用dsp解压mp3程序的算法
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% exmp2_11.m - Waveform and spectrum of sinewave corrupted by
%              white noise with Signal-to-noise ratio = 10 dB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

N=256; A=sqrt(20); w0=0.2*pi;  % define parameters
n = [0:N-1];                   % time index
sn = A*sin(w0*n);              % sine sequence
vn = (rand(1,N)-0.5)*sqrt(12); % zero-mean, unit-variance white noise
xn = sn+vn;                    % sinewave embedded in white noise
subplot(2,1,1);                % top figure
plot(n,xn)                     % plot the waveform
title('Waveform of noisy sinewave');
xlabel('Time index n'); ylabel('Amplitude');
axis([0 255 -inf inf])
Xk = fft(xn);                  % compute DFT
absXk = 20*log10(abs(Xk));     % magnitude spectrum in dB
subplot(2,1,2);                % bottom figure
plot(n,absXk)                  % plot the spectrum
title('Spectrum of noisy sinewave');
xlabel('Frequency index k'); ylabel('Magnitude in dB');
axis([0 127 -inf inf])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -