MATLAB实验二傅里叶分析与应用

  • 格式:doc
  • 大小:247.00 KB
  • 文档页数:11

1 / 11 实验二傅里叶分析及应用

一、实验目的

(一)掌握使用Matlab进行周期信号傅里叶级数展开和频谱分析

1、学会使用Matlab分析傅里叶级数展开,深入理解傅里叶级数的物理含义

2、学会使用Matlab分析周期信号的频谱特性

(二)掌握使用Matlab求解信号的傅里叶变换并分析傅里叶变换的性质

1、学会运用Matlab求连续时间信号的傅里叶变换

2、学会运用Matlab求连续时间信号的频谱图

3、学会运用Matlab分析连续时间信号的傅里叶变换的性质

(三) 掌握使用Matlab完成信号抽样并验证抽样定理

1、学会运用MATLAB完成信号抽样以及对抽样信号的频谱进行分析

2、学会运用MATLAB改变抽样时间间隔,观察抽样后信号的频谱变化

3、学会运用MATLAB对抽样后的信号进行重建

二、实验条件

Win7系统,MATLAB R2015a

三、实验内容

1、分别利用Matlab符号运算求解法和数值计算法求下图所示信号的FT,并画出其频谱图(包括幅度谱和相位谱)[注:图中时间单位为:毫秒(ms)]。

2 / 11

符号运算法

数值运算法 Code:

ft = sym('

(t+2)*(heaviside(t+2)-heaviside(t+1))+(heaviside(t+1)-heaviside(t-1))+(2-t)*(heaviside(t-1)-heaviside(t-2))');

fw = simplify(fourier(ft));

subplot(2, 1, 1);

ezplot(abs(fw)); grid on;

title('amp spectrum');

phi = atan(imag(fw) /

real(fw));

subplot(2, 1, 2);

ezplot(phi); grid on;

title('phase spectrum');

Code:

dt = 0.01;

t = -2: dt: 2;

ft =

(t+2).*(uCT(t+2)-uCT(t+1))+(uCT(t+1)-uCT(t-1))+(2-t).*(uCT(t-1)-uCT(t-2));

N = 2000;

k = -N: N;

w = pi * k / (N*dt);

fw = dt*ft*exp(-i*t'*w);

fw = abs(fw);

plot(w, fw), grid on;

axis([-2*pi 2*pi -1 3.5]);

3 / 11 00.511.522.5012345t(20  exp(-3 t) heaviside(t) - 8  exp(-5 t) heaviside(t))/(2 )2、试用Matlab命令求的傅里叶反变换,并绘出其时域信号图。

两个单边指数脉冲的叠加

3、已知门函数自身卷积为三角波信号,试用Matlab命令验证FT的时域卷积定理。

Code:

syms t;

fw =

sym('10/(3+i*w)-4/(5+i*w)');

ft = ifourier(fw, t);

ezplot(ft), grid on;

Code:

f = sym('heaviside(t+1) - heaviside(t-1)');

fw = simplify(fourier(f));

F = fw.*fw;

subplot(211);

ezplot(abs(F), [-9, 9]), grid on

title('FW^2')

tri =

sym('(t+2)*heaviside(t+2)-2*t*heaviside(t)+(t-2)*heaviside(t-2)');

Ftri = fourier(tri);

F = simplify(Ftri);

subplot(212);

ezplot(abs(F), [-9, 9]), grid on;

title('tri FT')

4 / 11

4、设有两个不同频率的余弦信号,频率分别为,;现在使用抽样频率对这三个信号进行抽样,使用MATLAB命令画出各抽样信号的波形和频谱,并分析其频率混叠现象

>

>

>

>

>

>

>

>

>

> Code:

f1 = 100; % f1 = 100 hz

ts = 1/4000;% sample = 4000hz

dt = 0.0001;

t1 = -0.007:dt:0.007;

ft = cos(2*f1*pi*t1);

subplot(221); plot(t1, ft), grid

on;

axis([-0.006 0.006 -1.5 1.5])

xlabel('Time/s'),ylabel('f(t)')

title('Cosine curve');

N = 5000; k = -N:N;

w = 2*pi*k/((2*N+1)*dt);

fw = ft*dt*exp(-1i*t1'*w);

subplot(222);

plot(w, abs(fw)); grid on;

axis([-20000 20000 0 0.005]);

xlabel('\omega'), ylabel('f(w)')

title('Cos freq spectrum'); t2 = -0.007:ts:0.007;

fst = cos(2*f1*pi*t2);

subplot(223);plot(t1, ft, ':'),

hold on

stem(t2, fst), grid on;

axis([-0.006 0.006 -1.5 1.5])

xlabel('Time/s'),ylabel('fs(t)')

title('Sample signal'); hold off

fsw=ts*fst*exp(-1i*t2'*w);

subplot(224); plot(w, abs(fsw)),

grid on

axis([-20000 20000 0 0.006])

xlabel('\omega'),ylabel('fsw')

title(' Sample freq spectrum');

5 / 11 -505x 10-3-101Time/sf(t)Cosine curve-2-1012x 104012345x 10-3f(w)Cos freq spectrum-505x 10-3-101Time/sfs(t)Sample signal-2-1012x 1040246x 10-3fsw Sample freq spectrum-505x 10-3-101Time/sf(t)Cosine curve-2-1012x 104012345x 10-3f(w)Cos freq spectrum-505x 10-3-101Time/sfs(t)Sample signal-2-1012x 1040246x 10-3fsw Sample freq spectrum

f1 = 100Hz

将代码中f1设为3800即可↓

f2 = 3800Hz

6 / 11 -505-0.500.51Sa(t)-2002000.511.5Sa(t) freq spectrum-505-0.500.51Sampling signal-5005000.511.5spectrum of Sampling signal5、结合抽样定理,利用MATLAB编程实现信号经过冲激脉冲抽样后得到的抽样信号及其频谱[建议:冲激脉冲的周期分别取4*pi/3 s、pi s、2*pi/3 s三种情况对比],并利用构建信号。(**改动第一行代码即可)

冲激脉冲的周期 = 4*pi/3 s

Ts = 4/3; % impulse period = 4*pi/3

t1 = -5:0.01:5;

ft = sinc(t1);

subplot(2, 2, 1)

plot(t1, ft), grid on

axis([-6 6 -0.5 1.2])

title('Sa(t)')

N = 500; k = -N: N;

W = pi*k / (N*0.01);

Fw = 0.01*ft*exp(-1i*t1'*W);

subplot(2, 2, 2)

plot(W, abs(Fw)), grid on

axis([-30 30 -0.05 1.5])

title('Sa(t) freq spectrum')

t2 = -5: Ts: 5;

fst = sinc(t2);

subplot(2, 2, 3)

plot(t1, ft, ':'), hold on

stem(t2, fst), grid on

axis([-6 6 -0.5 1.2])

title('Sampling signal')

Fsw = Ts*fst*exp(-1i*t2'*W);

subplot(2, 2, 4)

plot(W, abs(Fsw)), grid on

axis([-50 50 -0.05 1.5])

title('spectrum of Sampling signal')