![]() |
一个简单的fft问题
[IMG]http://p15.freep.cn/p.aspx?u=v20_p15_p_0903232122384600_0.jpg[/IMG]
小弟就是想模仿上面这个图用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); |
回复: 一个简单的fft问题
你这个polt用错了吧,好像没有你这么写的。
matlab里面应该自带矩形函数 |
回复: 一个简单的fft问题
y是fft后的值,为复数。
plot命令正常情况下,是给实数数据画图。 clear; clc; u=ones(1,57); U=fft(u,64); t=0:56; figure(1) stem(t,u); k=0:63; figure(2) stem(k,abs(U)) 上面画频谱的右半边 |
所有时间均为北京时间。现在的时间是 13:35。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.