| Electronics > Projects, Designs, and Technical Stuff |
| why The FFT can not compute this second harmonic correctly? |
| << < (5/6) > >> |
| rstofer:
--- Quote from: ali_asadzadeh on December 30, 2018, 07:02:18 am ---Thanks rstofer, Because the application should be so fast, I could only do the FFT in 1 full sin cycle, and for the second harmonic also I wanted to be able to calculate it in half the cycle of the full first harmonic cycle. --- End quote --- 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 This is on my Surface Book with an I7-6600 2.6 GHz processor. I imagine it would run a lot faster on my I7-7700 desktop but I have only licensed MATLAB for one machine. I don't think you are going to get away with just a single cycle of the 2d signal because it needs to be padded with 'something' to become a continuous signal at some integer multiple of the 1st signal. Any padding other than another cycle of the 2d signal is going to result in harmonics all over the place (I think). What kind of signal runs as a sin() for 1 cycle and 0v for 1 cycle and then repeats forever? A composite of a square wave and a sin() wave would do that but we already know that the square wave has odd harmonics from DC to daylight. |
| Conrad Hoffman:
There's some good public FFT code available. If you want it fast, code it yourself. http://www.fftw.org/ |
| ehughes:
Don't forget that but "not windowing" you are still "windowing" with a rectangular window. You are seeing the the interaction of the sin(x)/x functions shifted to the different bins and summed up. In the case you got all the zeros for most of the bins. The superposition of the sin(x) is still there, the bins just line up with nulls in the window function. In real world cases, your tones will never line up such that the nulls of the window function are at the bins in your FFT. You will always be looking at the effects of your window (rectangular or otherwise). It is just something you have to be aware of when doing your processing. |
| Rerouter:
--- 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. |
| ali_asadzadeh:
--- Quote ---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 --- Thanks, I would run the FFT on an 200MHz cortex M4 part using ARM DSP libraries :) and I have 8 channels of DATA, so I think I can only pad data to the 128 samples at most, so what window should I choose? Please note that my ADC is sampling all 8 channels in the ISR with the help of DMA, so I should update each cycle measurements and make some decisions and do some actions based on the results. so regarding all other-things including sampling and the time that's available to me I should find a fast, memory efficient way to do it. |
| Navigation |
| Message Index |
| Next page |
| Previous page |