Real-Time frequency analysis of acceleration data

5 ビュー (過去 30 日間)
Maximilian Becker
Maximilian Becker 2021 年 9 月 3 日
編集済み: Maximilian Becker 2021 年 9 月 20 日
Hi,
I am using Simulink Desktop Real-Time environment for reading a 3-axis acceleration sensor. The data is sampled in 2kHz and contains the magnitude of the acceleration. For each of the axis I would like to perfom some kind of FFT with the last 4 received values and find the dominant frequencies.
One criterium is that the frequencies in each axis should be comparable such that I can find "the" frequency of the measurements over all axis.
Does anyone have an idea on how to achieve this?
Thanks in advance,
Max
EDIT: I should have been clearer: I am working in Desktop Real-Time, but in external mode.

採用された回答

Jan Houska
Jan Houska 2021 年 9 月 10 日
Hi Max,
you can use blocks from the DSP System Toolbox library. There is a Buffer block that packs single data samples to buffers usable for computing the FFT, and then there is a FFT block that actually computes the FFT. Both these blocks are supported with Simulink Desktop Real-Time.
But if the number 4 is not a typo, this is way too short a buffer for FFT. You cannot get any meaningful frequency information from just 4 samples. The buffer must be significantly longer to get any useful results.
Good Luck, Jan
  3 件のコメント
Jan Houska
Jan Houska 2021 年 9 月 20 日
Hi Max,
I believe that both the Buffer and FFT blocks do support code generation. Is there any error you are getting when trying to use these blocks in external mode? Please beware that the FFT buffer length should be a power of two for best performance. Code generation may even require the buffer length to be a power of two.
Good Luck, Jan
Maximilian Becker
Maximilian Becker 2021 年 9 月 20 日
Let's say I did some thing very stupid and you were (of course) right. I tried to use the scope block for displaying it..
I now use this set up:
But the scope stays empty and does not advance in time. Am I missing something?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTarget Computer Setup についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by