Advertisement

信号与系统实验3 连续信号的频域分析

阅读量:

问题1 求实验图所示的周期信号(T=2 =1)的傅里叶级数,做出其前3、9、21、45项谐波的合成波形并与原信号做比较,作出其单边幅度谱和相位谱

复制代码
 t = -6:0.01:6;

    
 d = -6:2:6;
    
 fxx = pulstran(t,d,'tripuls'); %三角脉冲
    
 f1 = fourierseries(3,t);    %fourierseries 自定义函数
    
 f2 = fourierseries(9,t);
    
 f3 = fourierseries(21,t);
    
 f4 = fourierseries(45,t);
    
 N = length(fxx);
    
 f5 = fft(fxx,N);
    
 f = (0:N-1)'*100/N;
    
 f6 = angle(f5);
    
 subplot(3,2,1);plot(t,fxx,'r',t,f1,'b');xlabel('t');ylabel('f(t)');title('前3项谐波');
    
 grid on
    
 axis([-6 6 -0.1 1.1]);
    
 subplot(3,2,2);plot(t,fxx,'r',t,f2,'b');xlabel('t');ylabel('f(t)');title('前9项谐波');
    
 grid on
    
 axis([-6 6 -0.1 1.1]);
    
 subplot(3,2,3);plot(t,fxx,'r',t,f3,'b');xlabel('t');ylabel('f(t)');title('前21项谐波');
    
 grid on
    
 axis([-6 6 -0.1 1.1]);
    
 subplot(3,2,4);plot(t,fxx,'r',t,f4,'b');xlabel('t');ylabel('f(t)');title('前45项谐波');
    
 grid on
    
 axis([-6 6 -0.1 1.1]);
    
 subplot(3,2,5);stem(f(1:600),abs(f5(1:600)),'.');xlabel('w');ylabel('F(jw)');title('单边频谱图');
    
 grid on
    
 subplot(3,2,6);stem(f6,'.');xlabel('w');ylabel('f6');title('相位谱');
    
 grid on
    
 axis([0 1200 -200 200]);
    
 print(gcf,'-dpng','3-1.png');
    
    
    
    

问题2 求实验图所示的单个三角脉冲(=1)的傅里叶变换,并做出其幅度谱和相位谱

复制代码
 t = -6:0.01:6;

    
 d = -6:2:6;
    
 ft = pulstran(t,d,'tripuls').* (u(t+0.5)-u(t-0.5));%获取单个三角脉冲
    
 subplot(311);plot(t,ft);grid on
    
 L = length(ft);
    
 f7 = fft(ft,L);
    
 f8 = fftshift(f7);
    
 f = (0:L-1)'*100/L;
    
 subplot(312);plot(f,abs(f7));xlabel('w');ylabel('f8');title('幅度谱');grid on
    
 f9 = angle(f7);
    
 subplot(313);plot(t,f9);xlabel('w');ylabel('f');title('相位谱');grid on
    
 print(gcf,'-dpng','3-2.png');
    
    
    
    

问题3 求不同占空比下,周期矩形脉冲的幅度谱和相位谱,例如占空比=1/4,1/8

复制代码
 t = -6:0.01:6;

    
 d = -6:2:6;
    
 f = pulstran(t,d,'rectpuls',1);
    
 l = length(f);
    
 w = (0:l-1)'*100/l;
    
 ff = fftshift(fft(f,l));
    
 fa = angle(ff)/pi*180;
    
 fj = pulstran(t,d,'rectpuls',0.5); %原始即为1/2,在此再取1/2,即获得1/4的占空比
    
 fjf =fftshift(fft(fj,l)) ;
    
 fja = angle(fjf)/pi*180;
    
 fjj = pulstran(t,d,'rectpuls',0.25);
    
 fjjf = fftshift(fft(fjj,l));
    
 fjja = angle(fjjf)/pi*180;
    
 subplot(3,2,1);plot(w,abs(ff));xlabel('w');ylabel('F(jw)');title('单边频谱图');grid on
    
 subplot(3,2,2);plot(t,fa);xlabel('w');ylabel('fa');title('相位谱');grid on
    
 subplot(3,2,3);plot(w,abs(fjf));xlabel('w');ylabel('F(jw)');title('单边频谱图');grid on
    
 subplot(3,2,4);plot(t,fja);xlabel('w');ylabel('fja');title('相位谱');grid on
    
 subplot(3,2,5);plot(w,abs(fjjf));xlabel('w');ylabel('F(jw)');title('单边频谱图');grid on
    
 subplot(3,2,6);plot(t,fjja);xlabel('w');ylabel('fjja');title('相位谱');grid on
    
 print(gcf,'-dpng','3-3.png');
    
    
    
    

验证傅里叶变换的性质,如时移性质:选取f(t)和f(t-b),幅频曲线相同,只有相位不同;频移性质:选取u(t)和cosMtu(t)或sinMtu(t);对称性质:选取Sa(Mt)或g(t);尺度变换性:选取f(t)和f(at)

复制代码
 %时移性质

    
 t = -2*pi:0.01:2*pi;
    
 b = pi;
    
 f = sin(t);
    
 l = length(f);
    
 w = (0:l-1)'*100/l;
    
 f1 = sin(t-b);
    
 ff = fft(f);
    
 f1f = fft(f1);
    
 subplot(211);plot(w,abs(ff),'b',w,abs(f1f),'r');xlabel('t');ylabel('F');title('时移性质-幅频曲线');grid on
    
 fa = angle(ff);
    
 f1a = angle(f1f);
    
 subplot(212);plot(t,fa,'b',t,f1a,'r');xlabel('t');ylabel('angle');title('时移性质-相位图');grid on
    
 print(gcf,'-dpng','3-4.png');
    
 %频移性质
    
 t = -2*pi:0.01:2*pi;
    
 m = pi;
    
 f = u(t);
    
 l = length(f);
    
 w = (0:l-1)'*100/l;
    
 f1 = sin(m*t).*u(t);
    
 ff = fft(f);
    
 f1f = fft(f1);
    
 subplot(211);plot(w,abs(ff),'b',w,abs(f1f),'r');xlabel('w');ylabel('F');title('时移性质-幅频曲线');grid on
    
 fa = angle(ff);
    
 f1a = angle(f1f);
    
 subplot(212);plot(t,fa,'b',t,f1a,'r');xlabel('t');ylabel('angle');title('时移性质-相位图');grid on
    
 print(gcf,'-dpng','3-5.png');
    
 %对称性质
    
 t = -2*pi:0.01:2*pi;
    
 m = pi;
    
 f = sinc(m*t);
    
 f1 = sinc(-m*t);
    
 ff = fft(f);
    
 f1f = fft(ff);
    
 subplot(211);plot(w,abs(ff),'b',w,abs(f1f),'r');xlabel('t');ylabel('F');title('时移性质-幅频曲线');grid on
    
 fa = angle(ff);
    
 f1a = angle(f1f);
    
 subplot(212);plot(t,fa,'b',t,f1a,'r');xlabel('t');ylabel('angle');title('时移性质-相位图');grid on
    
 print(gcf,'-dpng','3-6.png');
    
 %尺度变换性
    
 t = -2*pi:0.01:2*pi;
    
 f = sin(t);
    
 l = length(f);
    
 w = (0:l-1)'*100/l;
    
 f1 = sin(2*t);
    
 ff = fft(f);
    
 f1f = fft(ff);
    
 subplot(211);plot(w,abs(ff),'b',w,abs(f1f),'r');xlabel('t');ylabel('F');title('时移性质-幅频曲线');grid on
    
 fa = angle(ff);
    
 f1a = angle(f1f);
    
 subplot(212);plot(t,fa,'b',t,f1a,'r');xlabel('t');ylabel('angle');title('时移性质-相位图');grid on
    
 print(gcf,'-dpng','3-7.png');
    
    
    
    


注意:四张图片忘记更改横坐标!

fourierseries函数自定义

复制代码
 function y=fourierseries(m,t)

    
 y=1/4;
    
 for n=1:m
    
     y=y+(8*sin(n*pi/4).*sin(n*pi/4))/(n.*n*pi*pi) .*cos(n.*pi.*t);
    
 end
    
 end
    
 function y=u(n)
    
 y=(n>=0);
    
 end
    
    
    
    

四、思考题

1、简述周期信号频谱的特点,当信号的周期T和脉宽发生变化时,信号的频谱怎样变化

周期信号的频谱是分立的,其中包含了一系列的谐波成分。其频谱是以周期为基础的,也就是说,只有基波及其谐波才存在于频域上。
当信号的周期T发生变化时,其谐波成分的频率也会相应的发生变化,其中的基波成分的频率会发生变化。
当信号的脉宽发生变化时,它的频谱也会发生变化,具有更高的频率成分。

2、总结周期信号和非周期信号频谱的不同和联系

周期信号是具有重复周期的信号,其频谱仅包含一组离散的频率分量,而非周期信号则没有重复周期,其频谱则包含连续的各种不同频率的分量。周期信号的频谱呈现出明显而有规律的频率分布,而非周期信号的频谱则呈现出连续而无规律的频率分布。

3、由傅里叶变换的性质,总结时域和频域的对应关系

具体来说,时域上的信号表示信号随时间变化的情况,而频域上的信号则表示信号在不同频率上的分布情况。由傅里叶变换的性质可知,时域上的周期信号,在频域上表现为离散的频谱线。而在频域上的周期信号,在时域上表现为时间延迟的复制。此外,时域上的卷积,在频域上表示为乘积。频域上的卷积,在时域上表示为时域卷积和。因此,时域和频域是相互对应的。

全部评论 (0)

还没有任何评论哟~