信号的频谱分析.docx
《信号的频谱分析.docx》由会员分享,可在线阅读,更多相关《信号的频谱分析.docx(16页珍藏版)》请在冰豆网上搜索。
![信号的频谱分析.docx](https://file1.bdocx.com/fileroot1/2023-1/4/88516723-a268-421e-ac1b-78aea62bc8a3/88516723-a268-421e-ac1b-78aea62bc8a31.gif)
信号的频谱分析
信号的频谱分析
实习报告
实验目的
1.掌握利用FFT分析连续周期,非周期信号的频谱,如周期,非周期方波,正弦信号等。
理解CFS,CTFT与DFT(FFT)的关系。
2.利用FFT分析离散周期,非周期信号的频谱,如周期,非周期方波,正弦信号等。
理解DFS,DTFT与DFT(FFT)的关系,并讨论连续信号与离散信号频谱分析方法的异同。
实验内容
1.利用FFT,分析并画出
频谱,改变采样间隔与截断长度,分析混叠与泄漏对单一频率成分信号频谱的影响。
2.利用FFT,分析并对比方波以及半波对称的正负方波的频谱,改变采样间隔与截断长度,分析混叠与泄漏对信号频谱的影响。
3.利用FFT,分析并画出
信号的频谱,改变采样间隔与截断长度,分析混叠与泄漏对信号频谱的影响。
4.利用不同窗函数对内容3.中的信号进行加窗处理,分析对信号频谱的影响;
5.*利用FFT计算线性卷积,验证‘实验三’中时域结果的正确性。
具体实验步骤及实验结果
1.
频谱
a.sin(100πt)程序,图像、频谱分析图及其幅度相位图
closeall;
clc;
clear;
t=0:
0.001:
0.999;
subplot(311)
a=sin(100*pi*t);
plot(t,a);gridon;title('sin100pi*t');xlabel('T');
b=fft(a);
subplot(312);
stem(t*1000,abs(b)/1000,'fill');xlabel('Hz');
gridon;title('频率特性')
subplot(313)
stem(t*1000,angle(b)/1000,'fill');xlabel('Hz');
gridon;title('相频特性')
b.cos(100πt)程序,图像、频谱分析图及其幅度相位图
closeall;
clc;
clear;
t=0:
0.001:
0.999;
subplot(311)
a=cos(100*pi*t);
plot(t,a);gridon;title('sin100pi*t');xlabel('T');
b=fft(a);
subplot(312);
stem(t*1000,abs(b)/1000,'fill');xlabel('Hz');
gridon;title('频率特性')
subplot(313)
stem(t*1000,angle(b)/1000,'fill');xlabel('Hz');
gridon;title('相频特性')
c.改变采样间隔与截断长度,分析混叠与泄漏对10Hz正弦波频率成分信号频谱的影响。
正确的正弦波特性曲线
采样间隔为0.01采样个数100
发生混叠现象采样间隔0.15
发生泄漏现象采样间隔0.01采样个数112
2.方波程序、频谱
clc;
t=0:
0.01:
1-0.01
a=square(2*pi*t,50)
subplot(311)
stem(t,a,'fill')
b=fft(a)
subplot(312)
stem(t*100,abs(b)/100,'fill')
gridon
subplot(313)
stem(t*100,angle(b)/100,'fill')
混叠现象
clc;
t=0:
0.01:
1-0.01
a=square(250*t,50)
subplot(311)
stem(t,a,'fill')
b=fft(a)
subplot(312)
stem(t*100,abs(b)/100,'fill')
subplot(313)
stem(t*100,angle(b)/100,'fill')
方波的泄露现象
clc;
t=0:
0.01:
0.86
a=square(20*t,50)
subplot(311)
stem(t,a,'fill')
b=fft(a)
subplot(312)
stem(t*86,abs(b)/86,'fill')
gridon
subplot(313)
stem(t*86,angle(b)/86,'fill')
3.
信号的频谱、真实值与理论值分析
closeall;
clc;
clear;
t=0:
0.01:
30-0.01;
a=1+j*pi*2*t;
a=1./a;
subplot(311);
plot(t,a);title('理论值');
gridon;
subplot(312);
plot(t,a,'r');axis([0,15,0,1]);
title('对比图');
holdon;
b=exp(-t);
c=fft(b);
plot(t,abs(c)/100,'g');
gridon;
holdon;
subplot(313);
stem(t,angle(c),'fill');title('相位图');
gridon;
4.利用不同窗函数对内容3.中的信号进行加窗处理
a.加入矩形窗
closeall;
clc;
clear;
w=0:
0.1:
30-0.1;
a=1+j*2*pi*w;
a=1./a;
plot(w,a,'r');
holdon;
t=0:
0.1:
30-0.1;
b=exp(-t);
c=fft(b);
plot(t,c/10,'g');axis([0,15,0,1]);
gridon;
holdon;
d=boxcar(600)';
y=d(301:
600);
e=y.*b;
f=fft(e);
plot(t,f/10,'y');
b.加入hanning窗
closeall;
clc;
clear;
w=0:
0.1:
30-0.1;
a=1+j*2*pi*w;
a=1./a;
plot(w,a,'r');
holdon;
t=0:
0.1:
30-0.1;
b=exp(-t);
c=fft(b);
plot(t,c/10,'g');axis([0,15,0,1])
gridon;
holdon;
d=hanning(600)';
y=d(301:
600);
e=b.*y;
f=fft(e);
plot(t,abs(f)/10,'b')
c.加入hamming窗
closeall;
clc;
clear;
w=0:
0.1:
30-0.1;
a=1+j*2*pi*w;
a=1./a;
plot(w,a,'r');
holdon;
t=0:
0.1:
30-0.1;
b=exp(-t);
c=fft(b);
plot(t,c/10,'g');axis([0,15,0,1]);
gridon;
holdon;
d=hamming(600)';
y=d(301:
600)
e=y.*b;
f=fft(e)
plot(t,f/10,'b')
d.三种窗函数的对比图
closeall;
clc;
clear;
t=0:
0.1:
30-0.1;
b=exp(-t);
c=fft(b);
plot(t,c/10,'g');axis([0,15,0,1]);
gridon;
holdon;
d=boxcar(600)';
y=d(301:
600);
e=y.*b;
f=fft(e);
plot(t,f/10,'y');
gridon;
holdon;
d=hamming(600)';
y=d(301:
600);
e=y.*b;
f=fft(e);
plot(t,f/10,'b');
gridon;
holdon;
d=hanning(600)';
y=d(301:
600);
e=b.*y;
f=fft(e);
plot(t,abs(f)/10,'r');;
5.*利用FFT计算线性卷积,验证‘实验三’中时域结果的正确性
closeall;
clc;
clear;
t=0:
0.01:
10-0.01;
b=exp(-t);
c=fft(b);
subplot(221);
stem(t,c/100,'g');axis([0,5,0,1]);
w=boxcar(1000)';
d=fft(w);
subplot(222);
stem(t,d/1000,'r');
a=conv(d,c)/2/pi
m=length(a)-1
n=0:
1:
m;
subplot(223);
stem(n,a/m/10,'fill');axis([0,15,0,1]);
subplot(224);
e=w.*b;
plot(t,e,'r');
holdon;
plot(n,a/m/10,'b');axis([0,15,0,1]);
gridon;
总结
通过此次实验,学会了利用DFT来对周期、非周期信号做频谱分析,通过调节系数来实现CTFT,CFS.
对采样定理理解更加深刻,通过改变采样间隔,实现混叠泄露现象。
得知采样的重要性,在今后的学习应用中,可以正确采样,不发生混叠泄露,使信号处理正确准确。
学会了窗函数的用法,通过对信号加矩形窗、hanning窗、hamming窗,加深了窗函数的概念理解,并且通过对同一个信号加不同窗的比较,出不同窗的特点。
对时域加窗相乘与频域卷积的比较得到时域结果的正确