数字信号处理实验5文档格式.docx
《数字信号处理实验5文档格式.docx》由会员分享,可在线阅读,更多相关《数字信号处理实验5文档格式.docx(19页珍藏版)》请在冰豆网上搜索。
>
w1=boxcar(25);
n=0:
24;
subplot(221),stem(n,w1),title('
矩形窗'
);
w2=hanning(25);
subplot(222),stem(n,w2),title('
hanning'
w3=hamming(25);
subplot(223),stem(n,w3),title('
hamming'
w4=bartlett(25);
subplot(224),stem(n,w4),title('
bartlett'
w5=blackman(25);
subplot(221),stem(n,w5),title('
blackman'
w6=triang(25);
subplot(222),stem(n,w6),title('
triang'
w7=kaiser(25,12);
subplot(223),stem(n,w7),title('
kaiser'
w8=chebwin(25,15);
subplot(224),stem(n,w8),title('
chebwin'
2、用MATLAB编程绘制各种窗函数的幅度响应。
Function[H,W]=dtft(h,N)
N=fix(N);
If(N<
L)
Error(‘DTFT:
#datasamplescannotexceed#freqsamples’)
End
(1)
wvtool(boxcar(64))
(2)
wvtool(hanning(64))
(3)
wvtool(hamming(64))
(4)
wvtool(bartlett(64))
(5)
wvtool(balckman(64))
(6)
wvtool(chebwin(64,15))
(7)
wvtool(kaiser(64,12))
(8)
3、绘制矩形窗的幅频响应,窗长度分别为:
N=10,N=20,N=50,N=100。
A、N=10
B、N=20
C、N=50
D、N=100
4、已知周期信号x(t)=0.75+3.4cosπft+2.7cos4πft+1.5sin3.5πft+2.5sin7πft,其中f=25/16Hz,若截断时间长度分别为信号周期的0.9和1.1倍,试绘制和比较采用下面窗函数提取的x(t)的频谱。
1、矩形窗
fs=10;
f=25/16;
Tp=4;
N=0.9*Tp*fs;
n=[0:
N-1];
w=boxcar(N);
x=0.75+3.4*cos(2*pi*f*n/fs)+2.7*cos(4*pi*f*n/fs)+1.5*sin(3.5*pi*f*n/fs)+2.5*sin(7*pi*f*n/fs);
y=w.*x'
;
[H,W]=dtft(y,1024);
subplot(211);
plot(W/2/pi,abs(H)),grid;
xlabel('
frequency'
),ylabel('
magnitude'
),title('
t=0.9Tp'
N=1.1*Tp*fs;
subplot(212);
t=1.1Tp'
2、汉宁窗
w=hanning(N);
3、汉明窗
w=hamming(N);
4、巴特利特窗
w=bartlett(N);
5、布莱克曼窗
w=blackman(N);
6、triang
w=triang(N);
7、kaiser窗
w=kaiser(N,18);
8、切比雪夫窗
w=chebwin(N,19);
w=chebwin(N,19);
四、结果分析: