Hi, Im trying to use ti's eZdsp F2812 to perform FFT on a simple sinewave. The FFT libraries provided allow me to extract the magnitude square of the fft but have no such allowance for the phase. The fft calculations are performed in the "in place computational buffer" and its supposed to hold the values of the fft result afterwards (real in the even positions and imag in the odd). I attempted to perform the magnitude calculations manually (mag=sqrt(ipcb[0]^2+ipcb[1]^2).. and so on) but my results dont match the results obtained by the fft libraries mag function. From looking at the ipcb buffer my results dont seem correct as every second number is very very large, when it should be zero. However somehow the mag function is able to read the exact same values and give me the correct result. Does anyone know if there is some special way to read the ipcb buffer to get the actual real and imaginary values out to calculate the mag and phase myself? The main reason i want to do this is to get the phase as the fft library has no provision for this. Any help would be greatly appreciated! Cheers Seb
phase and magnitude of FFT in TI's F2812
Started by ●October 11, 2006
Reply by ●October 11, 20062006-10-11
What is the data type in your ipcb[] array? If it is complex, then this may be where your manual calculation is failing.>Im trying to use ti's eZdsp F2812 to perform FFT on a simple sinewave.The>FFT libraries provided allow me to extract the magnitude square of thefft>but have no such allowance for the phase. >The fft calculations are performed in the "in place computationalbuffer">and its supposed to hold the values of the fft result afterwards (realin>the even positions and imag in the odd). > >I attempted to perform the magnitude calculations manually >(mag=sqrt(ipcb[0]^2+ipcb[1]^2).. and so on) but my results dont matchthe>results obtained by the fft libraries mag function. From looking at the >ipcb buffer my results dont seem correct as every second number is very >very large, when it should be zero. However somehow the mag function is >able to read the exact same values and give me the correct result. > >Does anyone know if there is some special way to read the ipcb buffer to >get the actual real and imaginary values out to calculate the mag and >phase myself? The main reason i want to do this is to get the phase asthe>fft library has no provision for this. > >Any help would be greatly appreciated! >Cheers >Seb > > >
Reply by ●October 12, 20062006-10-12
THanks for your reply. The ipcb aray is of type long, as that is how it is in all the examples ive seen. I dont think the FFT library allows for any other type. However after the FFT calculation, every second result should be complex, which is crazy because Ive never seen a "complex" data type in C or C++. I suspect they change the data type so that the fft library recognises its complex, but how is your average programmer meant to know how to convert it back? There is no mention of this in the FFT manual... Any ideas about getting the phase from this thing? Cheers>What is the data type in your ipcb[] array? If it is complex, then thismay>be where your manual calculation is failing. > >>Im trying to use ti's eZdsp F2812 to perform FFT on a simple sinewave. >The >>FFT libraries provided allow me to extract the magnitude square of the >fft >>but have no such allowance for the phase. >>The fft calculations are performed in the "in place computational >buffer" >>and its supposed to hold the values of the fft result afterwards (real >in >>the even positions and imag in the odd). >> >>I attempted to perform the magnitude calculations manually >>(mag=sqrt(ipcb[0]^2+ipcb[1]^2).. and so on) but my results dont match >the >>results obtained by the fft libraries mag function. From looking at the >>ipcb buffer my results dont seem correct as every second number is very >>very large, when it should be zero. However somehow the mag function is >>able to read the exact same values and give me the correct result. >> >>Does anyone know if there is some special way to read the ipcb bufferto>>get the actual real and imaginary values out to calculate the mag and >>phase myself? The main reason i want to do this is to get the phase as >the >>fft library has no provision for this. >> >>Any help would be greatly appreciated! >>Cheers >>Seb >> >> >> > > > > >
Reply by ●October 12, 20062006-10-12
It is quite common to find Complex data types in DSP vector libraries. I do not know the F2812 processor at all, but I guess you are using SPRC081 library? Take a look in the header file to see the prototype of the function you are using, and see if a special type is defined for it. You see, it could be that indexing through the data members of your buffer is actually creating a 'stride' of 2, which means that you are not accessing real and imaginary parts individually. Jeff