查看单个帖子
旧 2009-03-23, 21:24   #1
athlan20
初级会员
 
注册日期: 2009-02-17
年龄: 38
帖子: 1
声望力: 0
athlan20 正向着好的方向发展
默认 一个简单的fft问题



小弟就是想模仿上面这个图用matlab模拟下,程序如下
clear all;
figure(1);
t=-1:0.01:1;
y=(t>=-1 & t<=1)*1;
plot(t,y);
%以上为模拟出一个矩形脉冲信号;

figure(2);
w=-6*pi:0.01:6*pi;
Y=fft(y);
plot(w,Y);
%以上用fft画频谱,但是报错如下:
Warning: Imaginary parts of complex X and/or Y arguments ignored.
> In fft at 10
??? Error using ==> plot
Vectors must be the same lengths.

Error in ==> fft at 10
plot(w,Y);
athlan20 当前离线   回复时引用此帖