数字信号处理实验5.docx

上传人:b****5 文档编号:5372958 上传时间:2022-12-15 格式:DOCX 页数:19 大小:146.40KB
下载 相关 举报
数字信号处理实验5.docx_第1页
第1页 / 共19页
数字信号处理实验5.docx_第2页
第2页 / 共19页
数字信号处理实验5.docx_第3页
第3页 / 共19页
数字信号处理实验5.docx_第4页
第4页 / 共19页
数字信号处理实验5.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

数字信号处理实验5.docx

《数字信号处理实验5.docx》由会员分享,可在线阅读,更多相关《数字信号处理实验5.docx(19页珍藏版)》请在冰豆网上搜索。

数字信号处理实验5.docx

数字信号处理实验5

一、实验目的:

研究不同类型的窗函数,研究一些不同的方法来测试窗函数的性能;

专注于有关窄带信号的几个不同的情形。

二、实验原理:

信号是无限长的,而在进行信号处理时只能采用有限长信号,所以需要将信号“截断”。

在信号处理中,“截断”被看成是用一个有限长的“窗口”看无限长的信号,或者从分析的角度是无限长的信号x(t)乘以有限长的窗函数w(t),由傅里叶变换性质可知

三、实验内容:

1、用MATLAB编程绘制各种窗函数的形状。

>>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);

>>n=0:

24;

>>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

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)

wvtool(chebwin(64,15))

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;

>>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(212);plot(W/2/pi,abs(H)),grid;xlabel('frequency'),ylabel('magnitude'),title('t=1.1Tp');

2、汉宁窗

>>fs=10;

>>f=25/16;

>>Tp=4;

>>N=0.9*Tp*fs;

>>n=[0:

N-1];

>>w=hanning(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;

>>n=[0:

N-1];

>>w=hanning(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(212);plot(W/2/pi,abs(H)),grid;xlabel('frequency'),ylabel('magnitude'),title('t=1.1Tp');

3、汉明窗

>>fs=10;

>>f=25/16;

>>Tp=4;

>>N=0.9*Tp*fs;

>>n=[0:

N-1];

>>w=hamming(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;

>>n=[0:

N-1];

>>w=hamming(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(212);plot(W/2/pi,abs(H)),grid;xlabel('frequency'),ylabel('magnitude'),title('t=1.1Tp');

4、巴特利特窗

>>fs=10;

>>f=25/16;

>>Tp=4;

>>N=0.9*Tp*fs;

>>n=[0:

N-1];

>>w=bartlett(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;

>>n=[0:

N-1];

>>w=bartlett(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(212);plot(W/2/pi,abs(H)),grid;xlabel('frequency'),ylabel('magnitude'),title('t=1.1Tp');

5、布莱克曼窗

>>fs=10;

>>f=25/16;

>>Tp=4;

>>N=0.9*Tp*fs;

>>n=[0:

N-1];

>>w=blackman(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;

>>n=[0:

N-1];

>>w=blackman(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(212);plot(W/2/pi,abs(H)),grid;xlabel('frequency'),ylabel('magnitude'),title('t=1.1Tp');

6、triang

>>fs=10;

>>f=25/16;

>>Tp=4;

>>N=0.9*Tp*fs;

>>n=[0:

N-1];

>>w=triang(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;

>>n=[0:

N-1];

>>w=triang(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(212);plot(W/2/pi,abs(H)),grid;xlabel('frequency'),ylabel('magnitude'),title('t=1.1Tp');

7、kaiser窗

>>fs=10;

>>f=25/16;

>>Tp=4;

>>N=0.9*Tp*fs;

>>n=[0:

N-1];

>>w=kaiser(N,18);

>>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;

>>n=[0:

N-1];

>>w=kaiser(N,18);

>>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(212);plot(W/2/pi,abs(H)),grid;xlabel('frequency'),ylabel('magnitude'),title('t=1.1Tp');

8、切比雪夫窗

>>fs=10;

>>f=25/16;

>>Tp=4;

>>N=0.9*Tp*fs;

>>n=[0:

N-1];

>>w=chebwin(N,19);

>>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;

>>n=[0:

N-1];

>>w=chebwin(N,19);

>>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(212);plot(W/2/pi,abs(H)),grid;xlabel('frequency'),ylabel('magnitude'),title('t=1.1Tp');

四、结果分析:

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 交通运输

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1