I want to only fft last half of data from simulink
3 ビュー (過去 30 日間)
古いコメントを表示
I want to only apply fft to the last half of signal obtained from simulations in simulink. My take:
time=Vs_a.time(end/2:end);
vs_a=Vs_a.signals.values(end/2:end);
Ns=length(time);
Vsaf = abs(fft(vs_a))/Ns;
Vsaf(2:end)= Vsaf(2:end)*2;
This didn't give the results I expected, anyone got a clue what I'm doing wrong?
1 件のコメント
Adam
2016 年 8 月 31 日
You need to give more information that just that results are not as expected. What do you expect and what are you getting?
回答 (2 件)
David Barry
2016 年 8 月 30 日
The (end/2:end) indexing syntax will fail if you have an odd number of elements in your array. You would need to handle this case and decide which element you want. You could use round or floor, for example:
time=Vs_a.time(round(end/2):end);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Transforms についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!