This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

FFT Input Size

Other Parts Discussed in Thread: TMS320F28335, CONTROLSUITE

Hi,

 

I'm trying to use the FFT library from the control suite. The library seems to require that the output size be equal to the input size (or half the input size if we don't want the mirrored spectrum).  However, I want the size of the input to be 4096 and the output to be 1024 (512 if we remove the mirrored part). Does the library support this? If not, can you suggest ways to solve this problem?

  • Hi,

    the output size will always be the same as the input size in an FFT. But if you you just need 1024 result values, you will also need just 1024 input values.
    I do not know what you want to do this way, but you could simply use a smaller input buffer.

    Best regards
    Edwin Krasser

  • Thanks for the reply Edwin.

    I do understand that by default, the FFT output size will be the same as the input size. However, what I want to do is similar to the FFT function in Matlab where one can set N (the number of ouput points) regardless of the size of the input.

    The reason I want to do this is because I'm trying to capture vibrations in a structure and I want to sample more data before applying FFT.

    I've already thought of increasing the size of the output buffer but that would be inefficient for my case since my application only needs 1024 output points.

  • Hi,

    If I understand everything correctly, you do not need the full frequency resolution of a 4096 point FFT. Hence you could split your window of 4096 samples into 4 windows which you sum up in time domain: [0..1023]+[1024..2047]+[2048..3071]+[3072..4095] => 1024 input values => 1024 output values. Or you calculate four times the fft and average the magnitude values (averaging the Re/Im results should lead to the same results as time domain averaging).

    Or are you just interested in the lower 1024 frequency bins? Then you should use an FIR factor 4 downsampling filter and you will get 1024 input values again.

    Best regards
    Edwin Krasser

  • Hi,

    Actually, what I'm doing is similar to what you just mentioned. To give you a better idea, I need to get the FFT of a signal sampled at 1024 Hz for 12mins. That would be equivalent to 737280 values. However, since I can't just sample this much data at once, I plan to sample every 4 seconds (4096 samples) and apply FFT on it. The FFT output values would then be averaged.

    I can do what you said (get 1024 input values then apply FFT) but this would cause more errors on the final output due to the windowing of the signal and the delay in sampling caused by data processing.

  • Hi,

    You want to measure the power of different frequency bands of your signal? And you want to do this over a long time. Well, it looks like that doing an FFT every second (or every 4 seconds, or every 2?), calculating the magnitudes and calculating their average is a good solution for your long time fourier analysis.

    The only one idea I have regarding this problem is to implement some kind of vocoder stuff. You could use a bank of IIR band pass filters and split up your input signal this way in e.g. 100 frequency band signals (100 2nd order band pass filters at 1024 Hz => 102400 calculations per second. If your C2000 is clocked with 150 MHz you have far enough time to do this calculations, 100 filters need 5*100 coefficients and 4*100 delay line elements, memory should not become a problem). And you calculate the rms value of these 100 filter output signals. Just one thing: Your C2000 should have a floating point unit to do these filter calculations. Fixed point might make things difficult.

    Best regards and good luck
    Edwin Krasser

  • Could you give a code demo here that I can understand more easily ?Thanks a lot.Waiting  online.

  • That's a long time ago.

    What's your application now?
    Power distribution in frequency bands? What resolution do yqu need and which frequency span?
    And which processor do you use?

    Best regards, Edwin

  • Thanks a lot.I use TMS320F28335.In order to achieve FSK signal demodulation whose frequency spans about from 1700Hz to 2600Hz .However the frequencies of two carriers of FSK signal are so close such as 1689Hz and 1711Hz,as a result I need to improve the resolution of frequency.Worstly the CFFTSIZES of the DSC 28335 are limited less than 1024 points.What should I do?
    Best regards,Frank
  • Well, these are really very close frequencies. How is the Signal? If it's just the FSK signal and a rather good sinus I would suggest some band pass filtering (1700-2600 Hz pass band) to improve the signal quality first and a simple zero point detection afterwards: You can implement in the DSC some kind of analog comparator when comparing the current signal value (>0) and the previous signal value (<=0). Then you can calculate the period value. To improve the resolution of the zero point detection you could use linear interpolation.

    Best regards, Edwin!
  • Now my main design idea is that calculating 1024 points CFFT first and then cut out some frequency points such as 64 points near the peak of spectrum including mirrored part,next calculating ICFFT and add zero in the results of ICFFT to 1024 points ,finally doing 2nd CFFT.After analysing,the final resolution isn't enough.The main reason is that the first CFFT have dropped some frequencies informations or the resolution is low much which directly leads to final shift small error?
    Best regard,Frank!
  • The FFT-stuff might be an elegant solution in many applications. But if you need a high frequency resolution, FFT will often not be the best solution. As I mentioned, I suggest the analog-like solution with simple period time measurements with zero point detections because it delivers immediately the results and does not need much calculation time.

    Best regards and good luck!
  • Thanks heartedly. Definitely it's the best solution currently.Could you give a code demo like controlSUITE giving or code chip for me I can refer.
    Best regards!
  • Unfortunately I do not have code examples to publish. But it's simple. Just use a ticker in your signal processing routine and subtract the previous zero crossing ticker from the current one. And you get the period in ticks. And if necessary you can improve the resolution with linear interpolation of the zero crossing.

    Good luck!
  • I get it! Thanks very much.Is there in the morning in USA?What's your work time in a day?
    Best wishes!
  • It's late morning. 11:20 in Austria at the moment ...
  • What a beautiful country!You're welcome to China!