作业帮 > 综合 > 作业

急需一个关于 不同傅里叶变换长度的频谱分析能力 的MATLAB程序,

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/19 06:52:55
急需一个关于 不同傅里叶变换长度的频谱分析能力 的MATLAB程序,
为什么这个程序仿真出来以后啥也没有呢?
clear all;
t=0:0.1:50;
yp=sin(2*pi*2*t);
yq=sin(2*pi*2.0125*t);
y=yp+yq;
Y1=fft(y,512);
Y2=fft(y,4096);
Y=fftshift(Y1);
Y=fftshift(Y2);
c1=[0:255]/51.2;
c2=[0:2047]/409;
subplot(2,1,1);plot(c1,abs(Y1(257:512)));
axis([1.2,2.2,-30,300]);
title('512点FFT的频谱');grid on;
subplot(2,1,2);plot(c2,abs(Y2(2049:4096)));
axis([1.2,2.2,-30,300]);
title('4096点FFT的频谱');grid on;
%fftshift这个地方有错误
clear all;
t=0:0.1:50;
yp=sin(2*pi*2*t);
yq=sin(2*pi*2.0125*t);
y=yp+yq;
Y1=fft(y,512);
Y2=fft(y,4096);
Y1=fftshift(Y1);
Y2=fftshift(Y2);
c1=[0:255]/51.2;
c2=[0:2047]/409;
subplot(2,1,1);plot(c1,abs(Y1(257:512)));
axis([1.2,2.2,-30,300]);
title('512点FFT的频谱');grid on;
subplot(2,1,2);plot(c2,abs(Y2(2049:4096)));
axis([1.2,2.2,-30,300]);
title('4096点FFT的频谱');grid on;