1.用MATLAB符号运算求解法求单边指数信号法法f(t)=e^(-2t)u(t)的FT。代码如下:
ft=sym('exp(-2*t)*heaviside(t)');
>> fw=fourier(ft);
>> fw
fw =
1/(2 + w*1i)
2.用MATLAB符号运算求解法求F(jw)=1/(1+w^2)的IFT:程序代码如下:
close all;
>> clear all;
>> syms t;
>> Fw=sym('1/(1+w^2)');
>> ft=ifourier(Fw,t)
ft =
exp(-abs(t))/2
3.用MATLAB命令绘单边指数信号法法f(t)=e^(-2t)u(t)的频谱图
clear all
>> ft=sym('exp(-2*t)*heaviside(t)');
>> Fw=fourier(ft);
>> subplot(211),ezplot(abs(Fw)),grid on,title('幅度谱')
>> phase=atan(imag(Fw)/real(Fw));
subplot(212),ezplot(phase);grid on,title('相位谱')
>>
4. 用MATLAB命令求图示的三角脉冲的FT,并绘其频谱图
>> close all;
>> clear all
>> ft=sym('(t+4)/2*heaviside(t+4)-t*heaviside(t)+(t-4)/2*heaviside(t-4)');
>> Fw=simplify(fourier(ft));
>> Fw =
- (exp(-w*4i) + exp(w*4i) - w*exp(w*4i)*2i - 2)/(2*w^2) - pi*dirac(w)
%方法一
>> Fw_conj=conj(Fw);
>> Gw=sqrt(Fw*Fw_conj);
>subplot(121)
>> ezplot(Gw,[-pi pi]),grid on
>> %方法二
>> subplot(122)
>> ezplot(abs(Fw),[-pi pi]),grid on
5. 用MATLAB数值计算法求幅度频谱图
>> close all;
>> clear all
>> dt=0.01;
>> t=-4:dt:4;
>> ft=(t+4)/2.*((t+4)>=0)-t.*(t>=0)+((t-4)>=0);
>> N=2000;
>> k=-N:N;
>> w=pi*k/(N*dt);
>> F=dt*ft*exp(-j*t*w);
>> F=dt*ft*exp(-j*t'*w);
>> F=abs(F);
>> plot(w,F),grid on
>> axis([-pi pi -1 9])
>> xlabel('w'),ylabel('F(w)')
>> title('amplitude spectrum')
6.FT性质: 尺度变化
clear all
>> ft1=sym('heaviside(t+1/2)-heaviside(t-1/2)');
>> subplot(321)
>> ezplot(ft1,[-1.5 1.5]),grid on
>> Fw1=simplify(fourier(ft1));
>> subplot(322)
>> ezplot(abs(Fw1),[-10*pi 10*pi]),grid on
>> axis([-10*pi 10*pi -0.2 2.2])
>> ft2=sym('heaviside(t/2+1/2)-heaviside(t/2-1/2)');
>> subplot(323)
>> ezplot(ft2,[-1.5 1.5]),grid on
>> Fw2=simplify(fourier(ft2));
>> subplot(324)
>> ezplot(abs(Fw2),[-10*pi 10*pi]),grid on
>> axis([-10*pi 10*pi -0.2 2.2])
>> ft3=sym('heaviside(t*2+1/2)-heaviside(t*2-1/2)');
>> subplot(325)
>> ezplot(ft3,[-1.5 1.5]),grid on
>> Fw3=simplify(fourier(ft3));
>> subplot(326)
>> ezplot(abs(Fw3),[-10*pi 10*pi]),grid on
>> axis([-10*pi 10*pi -0.2 2.2])
7.FT性质-频移特性
>> close all
>> clear all
>> ft1=sym('4*heaviside(t+1/4)-heaviside(t-1/4)');
>> Fw1=simplify(fourier(ft1));
>> subplot(121)
>> ezplot(abs(Fw1),[-24*pi 24*pi]),grid on
>> axis([-24*pi 24*pi -0.2 2.2]),title('矩形信号频谱')
>> ft2=sym('4*cos(2*pi*6*t)*(heaviside(t+1/4)-heaviside(t-1/4))');
>> Fw2=simplify(fourier(ft2));
>> subplot(122)
>> ezplot(abs(Fw2),[-24*pi 24*pi]),grid on,title('矩形调制信号频谱')