登录论坛

查看完整版本 : 【求助】fft的问题 ,谢谢!


ffhhaa
2008-03-10, 17:41
实现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);”时什么意思
请高手能不能帮我解释下,谢谢!

ffhhaa
2008-03-11, 15:44
我现在知道了 谢谢~就是改变一下 频率间隔和频带宽度