画三角波信号频谱的MATLAB程序
N=8;
n1=-N:-1; %计算n=-N到-1的Fourier系数
c1=-4jsin(n1pi/2)/pi^2./n1.^2;
c0=0; %计算n=0时的Fourier系数
n2=1:N; %计算n=1到N的Fourier系数
c2=-4jsin(n2pi/2)/pi^2./n2.^2;
cn=[c1 c0 c2]; n=-N:N;
subplot(2,1,1); stem(n,abs(cn));
ylabel('Cn的幅度');
subplot(2,1,2); stem(n,angle(cn));
ylabel('Cn的相位');
xlabel('omega/omega0');
下载地址
用户评论