回 帖 发 新 帖 刷新版面

主题:fft的问题 谢谢!

实现y=5*cos((pi/8)*t+(pi)/4)的2-fft变换
程序如下:
T0=16;N=16;T=1;
t=0:1:16;
x=5*cos((pi/8)*t+(pi)/4);
X=1/N*fft(x,N);
f=1/T/N*(-N/2:N/2);
subplot(3,1,1);plot(t,x);
subplot(3,1,2);stem(f,abs(fftshift(X)));
subplot(3,1,3);stem(f,angle(fftshift(X)));

画出了 时域图 可是画不出频域的幅度和响频谱 
提示的时“??? Error using ==> stem
The length of X must match the number of rows of Y.”
我就是这里搞不懂“ f=1/T/N*(-N/2:N/2);”时什么意思
请高手能不能帮我解释下,谢谢!

回复列表 (共1个回复)

沙发

我现在知道了 谢谢~就是改变一下 频率间隔和频带宽度

我来回复

您尚未登录,请登录后再回复。点此登录或注册