Electronics > Projects, Designs, and Technical Stuff
why The FFT can not compute this second harmonic correctly?
<< < (6/6)
Marco:
If you just want two frequencies it's cheaper to do correlation with 2 sines and 2 cosines.
rstofer:

--- Quote from: Rerouter on December 31, 2018, 02:38:44 am ---
--- Quote from: rstofer on December 30, 2018, 06:13:12 pm ---The execution times seem highly variable but the first execution is very slow.

1) 125 ms
2) 798 us
3) 257 us
4) 153 us
5) 512 us

--- End quote ---
That screams of just in time compilation to me, first run compiles the bytecode, the later only needs to run it.

--- End quote ---
I'm pretty sure that is exactly the case.  Plus allocation of variables the first time through.  What I don't understand is why the time increased for run #5.

Alas, this has nothing to do with a 200 MHz ARM because a)  for the ARM, all of the variables are static and known at compile time, b) there is no multi-tasking to get in the way (maybe) and c) the algorithm can be highly optimized.

Not understanding the larger project and given what is discussed so far, I would use an FPGA or perhaps something with dedicated DSP hardware.

Here is a very interesting paper from MIT on the subject of FFT on FPGA but it really spends the majority of the time decomposing the FFT itself.  Lots of pseudo code

http://web.mit.edu/6.111/www/f2017/handouts/FFTtutorial121102.pdf
Rerouter:
Run 2 and 5 are longer, its similar to python where some runs have access delays to external resources, some of the commands you call may be external, and depending on how well things are synced up cause undesirable delays for only some runs.

Yes for ARM it matters less as you can chose what is loaded to memory, and generally have less competition of resources.

To the OP, the M4 has no L1/L2 caching, so if your really chasing speed, a lot of it will probably be dealing with memory delays. If the code your referencing uses cache hinting such as the "PLD" op code, you can strip it to gain back some cycles (M4 will just execute them as NOP's)
ali_asadzadeh:
Thanks for all your feadback,


--- Quote ---If you just want two frequencies it's cheaper to do correlation with 2 sines and 2 cosines.
--- End quote ---
Do you have some pseudo code or matlab code?
Marco:
Just do a pointwise multiplication with a sine and cosine and take the root of the summed squares of the results to get the magnitude for one frequency.
Navigation
Message Index
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod