个人收集整理-仅供参考
实验一 用FFT进行信号谱分析
1、实验步骤
(1)复习DFT地定义、性质和用DFT作谱分析地有关内容. (2)复习FFT算法原理并读懂FFT Matlab语言地编程思想. (3)编制信号产生子程序,产生一下典型信号供谱分析使用.
x1(n)R4(n)
n1,0n3x2(n)8n4n7
0其它n4n0n3x3(n)n34n7
0其它nx4(n)cosn 4x5(n)sin4n
x6(t)cos8tcos16tcos20t
实验一 主程序框图
2、上机实验内容
(1)、对2中所给出地信号分别进行谱分析,试验参数如下:
x1(n)、x2(n)、x3(n)、x4(n)、x5(n)进行DFT时地点数N=8
对于x6(t)需进行采样,采样频率fs(Hz),点数N16,32,
) (2)令x7(n)x4(n5x(n)用FFT计算8点地离散付立叶变换: ,
X7(k)DFT[x7(n)],并根据DFT地对称性,由X7(k)求出X4(k)和X5(k),
并与(1)中所得地结果进行比较.b5E2R。 (3)令x8(n)x4(n)jx5(n),重复(2).
1 / 13
个人收集整理-仅供参考
3、思考题
(1) N=8时,x2(n)和x3(n)地幅频特性是否相同?为什么?N=16呢?由实验可
知都不相同.
(2) 如果周期信号地周期预先不知道,如何用FFT进行谱分析?
周期信号地周期预先不知道时,可先截取M点进行DFT,再将截取长度扩大1倍截取,比较结果,如果二者地差别满足分析误差要求,则可以近似表示该信号地频谱p1Ean。 (1)% 第一 x1=[1 1 1 1]; a=fft(x1,8); subplot(2,3,1); stem(abs(a));
% 第二
for n=1:1:4; x(n)=n; end
for n=5:1:8; x(n)=9-n; end
a=fft(x,8);
subplot(2,3,2); stem(abs(a)); % 第三
for n=1:1:4; x(n)=5-n; end
for n=5:1:8; x(n)=4; end
a=fft(x,8);
subplot(2,3,3); stem(abs(a)); % 第四 n=1:1:8;
x(n)=cos(pi/4*n); a=fft(x,8);
subplot(2,3,4); stem(abs(a)); % 第五
n=1:1:8
2 / 13
个人收集整理-仅供参考
x(n)=sin(pi/4*n); a=fft(x,8);
subplot(2,3,5); stem(abs(a)); clear all
t=0:1/:15/;
x=cos(8*pi*t)+cos(16*pi*t)+cos(20*pi*t); b=fft(x,16); c=fft(x,32); d=fft(x,); subplot(3,1,1); stem(abs(b)); subplot(3,1,2); stem(abs(c)); subplot(3,1,3) stem(abs(d))
4321005104321005102015105005104321005103 / 13
30201000510
个人收集整理-仅供参考
151050151050151050010203040506070051015202530350246810121416
(2)clear all n=1:1:8;
x4=cos(pi/4*n); x5=sin(pi/4*n); x7=x4+x5; a=fft(x7,8); subplot(3,1,1) stem(abs(a)); x4_2=real(a); subplot(3,1,2); stem(abs(x4_2)); x5_2=imag(a); subplot(3,1,3); stem(abs(x5_2))
4 / 13
个人收集整理-仅供参考
201050210123456781x 10-15234567812345678
(3)clear all n=1:1:8;
x4=cos(pi/4*n); x5=sin(pi/4*n); x8=x4+j*x5; a=fft(x8,8); subplot(3,1,1); stem(abs(a));
x4_2=(x8+conj(x8))/2; subplot(3,1,2); stem(abs(x4_2));
x5_2=(x8-conj(x8))/2; subplot(3,1,3); stem(abs(x5_2));
5 / 13
个人收集整理-仅供参考
105010.5010.50123456781234567812345678
思考题:
实验二 频谱细化、频谱泄漏及栅栏效应
1、上机实验内容
(1) 在实验一地基础上,频谱细化时选取地参数: N=16,32, x6(t) 地取样
频率同实验一.编制相应地程序.
(2) 用505Hz正弦波信号地频谱分析来说明栅栏效应所造成地频谱计算误
差,参数如下:设定采样频率:fs=5120Hz,FFT计算点数为 512,其离散频率点为:
fi = i.fs/N = i.5120/512=10 , i= 0,1,2,….,N/2
位于505Hz 位置地真实谱峰被挡住看不见,看见地只是它们在相邻频率500Hz或510Hz处能量泄漏地值.
若设 fs=2560Hz,则频率间隔 df=5Hz,重复上述分析步骤,这时在505位置有谱线,我们就能得到它们地精确值.
从时域看,这个条件相当于对信号进行整周期采样,实际中常用此方法来提高周期信号地频谱分析精度.
6 / 13
个人收集整理-仅供参考
编制相应地程序,并绘制频谱图.DXDiT。 (3)对300Hz正弦波信号分别用矩形窗截断和汉宁窗截断,计算截断前后该
正弦波信号地地频谱,观察其频谱泄漏情况.采样频率fs=1200Hz,窗地长度N=512.RTCrp。 编制相应地程序,并绘制加窗前后地频谱图.
2、思考题
(1) 信号整周期采样时,其FFT谱中是否还存在能量泄漏误差 ? 不存在 (2) 对信号地频谱进行细化时,对序列进行末尾补零点后,序列地长度必须是原序
列长度地整数倍吗?是地
(2)clear all fs=2560; N=512;
t=0:1/fs:(N-1)/fs; x=sin(2*pi*505*t); subplot(2,1,1); plot(x)
y=fft(x,512); y=fftshift(y);
f=fs/N.*[-N/2:1:N/2-1] subplot(2,1,2); stem(f,abs(y))
7 / 13
个人收集整理-仅供参考
10.50-0.5-101002003004005006003002001000-1500-1000-500050010001500
(3)
clear all fs=1200; N=512;
z_1=boxcar(N); z_2=hanning(N); t=0:1/fs:(N-1)/fs; x=sin(2*pi*300*t); x_1=x.*z_1.'; y_1=fft(x_1,N); y_1=fftshift(y_1); x_2=x.*z_2.'; y_2=fft(x_2,N); y_2=fftshift(y_2);
f=fs/N.*[-N/2:1:N/2-1]; subplot(2,1,1) plot(f,abs(y_1)) title('矩形窗时'); subplot(2,1,2) plot(f,abs(y_2)) title('汉宁窗时');
8 / 13
个人收集整理-仅供参考
矩形窗时3002001000-600-400-2000汉宁窗时200400600150100500-600-400-2000200400600
实验五 圆周卷积在信号处理中地应用
1、上机实验内容
1) 产生一个正弦序列和一个白噪声序列,设计一个 FIR数字滤波器h(n),直接用线性卷积地方法实现对输入信号地滤波5PCzV。 2) 用圆周卷积计算上述滤波器地输出 3) 用FFT(圆周卷积定理)计算滤波器地输出
4) 产生一个点数远远大于FIR数字滤波器阶数地带有白噪声地序列.用重 叠相加法实现对输入信号地滤波.
2、思考题
(1) 比较直接计算线性卷积和用圆周卷积定理实现滤波地运算时间并对其结果进行分析.圆周卷积运算时间较短,圆周卷积相当于周期卷积地主值序列,计算量较小jLBHr。 (2) 比较直接计算线性卷积和用重叠相加法实现滤波地运算时间并对其结果
9 / 13
个人收集整理-仅供参考
进行分析.
(3) 计算长序列线性卷积除了用重叠相加法外,是否还有其他方法?你能实现
吗?重叠保留法 (1)clear all
to=clock;
load('D:/data6.mat') who
y=conv(h,x2); plot(y)
t=etime(clock,to)
矩形窗时3002001000-6000.40.20-0.2-0.401-400-20002004006002345678x 1094
(2)clear all to=clock;
load('d:/data6.mat') who
M=length(h); N=length(x2); L=M+N-1; h=fft(h,L); x2=fft(x2,L); y=h.*x2.'; y=ifft(y); plot(abs(y))
t=etime(clock,to)
10 / 13
个人收集整理-仅供参考
矩形窗时3002001000-6000.40.30.20.1001-400-20002004006002345678x 1094
(3)clear all to=clock;
load('D:/Data6.mat') who
y=fftfilt(h,x2); plot(y)
t=etime(clock,to)
0.30.20.10-0.1-0.2-0.3-0.4012345678x 1094
11 / 13
个人收集整理-仅供参考
版权申明
本文部分内容,包括文字、图片、以及设计等在网上搜集整理.版权为个人所有
This article includes some parts, including text, pictures, and design. Copyright is personal ownership.xHAQX。 用户可将本文地内容或服务用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律地规定,不得侵犯本网站及相关权利人地合法权利.除此以外,将本文任何内容或服务用于其他用途时,须征得本人及相关权利人地书面许可,并支付报酬.LDAYt。 Users may use the contents or services of this article for personal study, research or appreciation, and other non-commercial or non-profit purposes, but at the same time, they shall abide by the provisions of copyright law and other relevant laws, and shall not infringe upon the legitimate rights of this website and its relevant obligees. In addition, when any content or service of this article is used for other purposes, written permission and remuneration shall be
12 / 13
个人收集整理-仅供参考
obtained from the person concerned and the relevant obligee.Zzz6Z。
转载或引用本文内容必须是以新闻性或资料性公共免费信息为使用目地地合理、善意引用,不得对本文内容原意进行曲解、修改,并自负版权等法律责任.dvzfv。 Reproduction or quotation of the content of this article must be reasonable and good-faith citation for the use of news or informative public free information. It shall not misinterpret or modify the original intention of the content of this article, and shall bear legal liability such as copyright.rqyn1。
13 / 13