信号的频谱分析

信号的频谱分析

实习报告

实验目的

1. 掌握利用FFT 分析连续周期,非周期信号的频谱,如周期,非周期方波,正弦信号等。理解CFS ,CTFT 与DFT (FFT )的关系。

2. 利用FFT 分析离散周期,非周期信号的频谱,如周期,非周期方波,正弦信号等。理解DFS ,DTFT 与DFT (FFT )的关系,并讨论连续信号与离散信号频谱分析方法的异同。 实验内容 1.

利用FFT ,分析并画出sin(100πt ),cos(100πt ) 频谱,改变采样间隔与截

断长度,分析混叠与泄漏对单一频率成分信号频谱的影响。 2. 利用FFT ,分析并对比方波以及半波对称的正负方波的频谱,改变采样间隔与截断长度,分析混叠与泄漏对信号频谱的影响。 3.

利用FFT ,分析并画出e -t u (t ) 信号的频谱,改变采样间隔与截断长度,

分析混叠与泄漏对信号频谱的影响。 4. 利用不同窗函数对内容3. 中的信号进行加窗处理,分析对信号频谱的影响; 5. *利用FFT 计算线性卷积,验证‘实验三’中时域结果的正确性。

具体实验步骤及实验结果 1. sin(100πt ),cos(100πt ) 频谱

a .sin(100πt) 程序,图像、频谱分析图及其幅度相位图 close all; clc; clear;

t=0:0.001:0.999; subplot(311) a=sin(100*pi*t);

plot(t,a);grid on;title('sin100pi*t');xlabel('T'); b=fft(a);

subplot(312);

stem(t*1000,abs(b)/1000,'fill');xlabel('Hz'); grid on;title('频率特性')

subplot(313)

stem(t*1000,angle(b)/1000,'fill');xlabel('Hz'); grid on;title('相频特性')

sin100pi*t

10

-1

00.10.20.30.40.5T

频率特性

0.60.70.80.91

-3

Hz

x 10

相频特性

[**************]0Hz

[**************]0

b .cos(100πt) 程序,图像、频谱分析图及其幅度相位图 close all; clc; clear;

t=0:0.001:0.999; subplot(311) a=cos(100*pi*t);

plot(t,a);grid on;title('sin100pi*t');xlabel('T'); b=fft(a);

subplot(312);

stem(t*1000,abs(b)/1000,'fill');xlabel('Hz'); grid on;title('频率特性')

subplot(313)

stem(t*1000,angle(b)/1000,'fill');xlabel('Hz'); grid on;title('相频特性')

cos100pi*t

10

-1

00.10.20.30.40.5T

频率特性

0.60.70.80.91

-3

Hz

x 10

相频特性

[**************]0Hz

[**************]0

c. 改变采样间隔与截断长度,分析混叠与泄漏对10Hz 正弦波频率成分信号频谱的影响。

正确的正弦波特性曲线

采样间隔为0.01采样个数100

1

-100.10.20.30.40.50.60.70.80.91

[***********]0100

发生混叠现象采样间隔0.15

1

-10.1

051015

0.05

0x 10

-3

[1**********]000

5

-5

[**************]

发生泄漏现象采样间隔0.01 采样个数112

1

-100.20.40.60.811.21.4

[**************]40

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') grid on

subplot(313)

stem(t*100,angle(b)/100,'fill')

[***********]0100

混叠现象 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')

[***********]0100

[***********]0100

方波的泄露现象 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') grid on

subplot(313)

stem(t*86,angle(b)/86,'fill')

[***********]0

[***********]0

3.e t u (t ) 信号的频谱、真实值与理论值分析 close all; clc; clear;

t=0:0.01:30-0.01; a=1+j*pi*2*t; a=1./a;

subplot(311);

plot(t,a);title('理论值'); grid on;

subplot(312);

plot(t,a,'r');axis([0,15,0,1]); title('对比图'); hold on; b=exp(-t); c=fft(b);

plot(t,abs(c)/100,'g'); grid on; hold on;

subplot(313);

stem(t,angle(c),'fill');title('相位图'); grid on;

理论值

1

0.5

051015对比

202530

1

0.5

05

相位图

1015

[1**********]0

4. 利用不同窗函数对内容3. 中的信号进行加窗处理 a .加入矩形窗 close all; clc; clear;

w=0:0.1:30-0.1; a=1+j*2*pi*w; a=1./a;

plot(w,a,'r'); hold on;

t=0:0.1:30-0.1; b=exp(-t); c=fft(b);

plot(t,c/10,'g');axis([0,15,0,1]); grid on; hold on;

d=boxcar(600)'; y=d(301:600); e=y.*b; f=fft(e);

plot(t,f/10,'y');

10.9

0.80.70.60.50.40.30.20.10

051015

b. 加入hanning 窗 close all; clc; clear;

w=0:0.1:30-0.1; a=1+j*2*pi*w; a=1./a;

plot(w,a,'r'); hold on;

t=0:0.1:30-0.1; b=exp(-t); c=fft(b);

plot(t,c/10,'g');axis([0,15,0,1]) grid on; hold on;

d=hanning(600)'; y=d(301:600); e=b.*y; f=fft(e);

plot(t,abs(f)/10,'b')

10.9

0.80.70.60.50.40.30.20.10

051015

c. 加入hamming 窗 close all; clc; clear;

w=0:0.1:30-0.1; a=1+j*2*pi*w; a=1./a;

plot(w,a,'r'); hold on;

t=0:0.1:30-0.1; b=exp(-t); c=fft(b);

plot(t,c/10,'g');axis([0,15,0,1]); grid on; hold on;

d=hamming(600)'; y=d(301:600) e=y.*b; f=fft(e)

plot(t,f/10,'b')

10.9

0.80.70.60.50.40.30.20.10

051015

d. 三种窗函数的对比图 close all; 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]); grid on; hold on;

d=boxcar(600)'; y=d(301:600); e=y.*b; f=fft(e);

plot(t,f/10,'y'); grid on; hold on;

d=hamming(600)'; y=d(301:600); e=y.*b; f=fft(e);

plot(t,f/10,'b'); grid on; hold on;

d=hanning(600)'; y=d(301:600); e=b.*y; f=fft(e);

plot(t,abs(f)/10,'r');;

10.9

0.80.70.60.50.40.30.20.10

051015

5.*利用FFT 计算线性卷积,验证‘实验三’中时域结果的正确性 close all; 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'); hold on;

plot(n,a/m/10,'b');axis([0,15,0,1]); grid on;

012345

10.80.60.40.20

[1**********]5

总结

通过此次实验,学会了利用DFT 来对周期、非周期信号做频谱分析,通过调节系数来实现CTFT,CFS.

对采样定理理解更加深刻,通过改变采样间隔,实现混叠泄露现象。得知采样的重要性,在今后的学习应用中,可以正确采样,不发生混叠泄露,使信号处理正确准确。

学会了窗函数的用法,通过对信号加矩形窗、hanning 窗、hamming 窗,加深了窗函数的概念理解,并且通过对同一个信号加不同窗的比较,出不同窗的特点。

对时域加窗相乘与频域卷积的比较得到时域结果的正确


© 2024 实用范文网 | 联系我们: webmaster# 6400.net.cn