DSP

DSP实验报告(三)之连续时间信号的数字处理

2019-07-13 11:25发布

class="markdown_views prism-github-gist">

一、对连续时间信号进行离散抽样,样例程序

clf; t = 0:0.0005:1; f = 3; xa = cos(2*pi*f*t); subplot(2,1,1) plot(t,xa);grid xlabel('Time, msec');ylabel('Amplitude'); title('Continuous-time signal x_{a}(t)'); axis([0 1 -1.2 1.2]) subplot(2,1,2); T = 0.1; n = 0:T:1; xs = cos(2*pi*f*n); k = 0:length(n)-1; stem(k,xs);grid; xlabel('Time index n');ylabel('Amplitude'); title('Discrete-time signal x[n]'); axis([0 (length(n)-1) -1.2 1.2])

二、设计巴特沃兹低通滤波器,其中通带截止频率为3000Hz,阻带截止频率为4000Hz,通带波纹0.5dB,最小阻带衰减30dB,绘制增益响应。所设计的滤波器的阶数和3dB截止频率分别是多少?

clf; Fp = 3000;Fs = 4000; Wp = 2*pi*Fp; Ws = 2*pi*Fs; [N, Wn] = buttord(Wp, Ws, 0.5, 30,'s'); disp('阶数'); disp(N); disp('3db截止频率'); disp(Wn); [b,a] = butter(N, Wn, 's'); wa = 0:(3*Ws)/511:3*Ws; h = freqs(b,a,wa); plot(wa/(2*pi), 20*log10(abs(h)));grid %频率响应和增益相应还差20log的关系 xlabel('Frequency, Hz');ylabel('Gain, dB'); title('Gain response'); axis([0 3*Fs -60 5]); 阶数 16 3db截止频率 2.0254e+04