フィルターのクリア

How can I make this work? Invalid data type. First argument must be double, single, int8, uint8, int16, uint16, int32, uint32, or logical. Error in AccelerationWeek10 (line 15)16. s = fft(Accel);%3

6 ビュー (過去 30 日間)
1.close all 2.npts = 2^15; 3.sfreq = 22150; 4. dt = 1/sfreq; 5. t = (0:npts-1)'*dt; 6. m = 500 % mass 7. k = 1000000; 8. c= 1000; 9. naturalFr = sqrt(k/m) 10. sim('week7')% Simulink 11. figure(1) 13.plot(Accel) 14. xlabel('Time [s]') 15. ylabel('Signal [units]') 16. s = fft(Accel);%3
  1 件のコメント
Jan
Jan 2018 年 5 月 12 日
編集済み: Jan 2018 年 5 月 12 日
Remove the numeration of the lines, but select the code with the mouse and press the "{} Code" button. Afterwards your code is readable.
What is Accel? According to the error message it does not contain numerical data. But it should.

サインインしてコメントする。

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 5 月 12 日
It seems that Accel is produced by To Workspace block in your Simulink model 'week7'. In this case Accel will have the class timeseries, and therefore you are getting the error. You need to use Data property of Accel for fft(). So try
s = fft(Accel.Data);

その他の回答 (1 件)

Stephen Bell
Stephen Bell 2018 年 5 月 13 日
Thank you very much that worked

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by