MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   (FFT) 把这个量的频谱显示出来,不知道用什么语句好。 (https://www.labfans.com/bbs/showthread.php?t=2972)

28637634 2008-05-11 16:53

(FFT) 把这个量的频谱显示出来,不知道用什么语句好。
 
ia是从一个仿真模型中导出的一个量,我要做的是把这个量的频谱显示出来,不知道用什么语句好。
下面的代码好像是说ia这个量不符合要求,我该怎么做才能正确的把ia的频谱显示出来呢?求助~

t=0:1/512:1;x=ia;
y=fft(x);m=abs(y);f=(0:length(y)-1)'*512/length(y);
figure(1);subplot(2,1,1),plot(t,x),grid on;title('信号检测');
ylabel('Input \itx'),xlabel('Time');
subplot(2,1,2),plot(f,m);
ylabel('Abs. Magnitude'),grid on;
xlabel('Frequency(Hertz)')
[COLOR="Red"]??? Error using ==> fft
Function 'fft' is not defined for values of class 'struct'.[/COLOR]

ilyfe1998 2008-05-13 10:55

[QUOTE=28637634;10586]ia是从一个仿真模型中导出的一个量,我要做的是把这个量的频谱显示出来,不知道用什么语句好。
下面的代码好像是说ia这个量不符合要求,我该怎么做才能正确的把ia的频谱显示出来呢?求助~

t=0:1/512:1;x=ia;
y=fft(x);m=abs(y);f=(0:length(y)-1)...[/QUOTE]

错误提示的意思大概是说:fft的用法不对,有关fft的变量结构不正确
你检查一下ia这个量是什么形式的,y=fft(x)中的x必需是矩阵或多维数组

xyz20070912 2008-05-13 22:52

结构体类型?
 
[COLOR="Red"]Function 'fft' is not defined for values of class 'struct'. [/COLOR]

难道你的ia是结构体类型?

coofox 2008-05-13 22:56

你的那个ia量的具体值有没有?

28637634 2008-05-14 10:24

先谢谢楼上朋友的回复。

>> whos
Name Size Bytes Class

Im1 1x1 29240 struct array
It1 1x1 29238 struct array
ia 1x1 29198 struct array
ib 1x1 29200 struct array
m 1x1 29220 struct array
tout 1000x1 8000 double array
w 1x1 29222 struct array

是struct array,怎么把这个转换为FFT需要的数据呢?

28637634 2008-05-14 10:26

[QUOTE=coofox;10705]你的那个ia量的具体值有没有?[/QUOTE]


打开workspace中的ia显示:
time: []
signals: [1x1 struct]
blockName: 'gz_modified_by_wpn/To Workspace'

ia是一个输出。是个随时间的变化量。


所有时间均为北京时间。现在的时间是 11:13

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.