Other Parts Discussed in Thread: C2000WARE
Hi,
I am trying to use RFFT for analog data on F28379D-LAUNCHXL. Before that I have constructed the below signal in MATLAB at the frequency of 3.2 ksps


than converted the decimal values to the Q31 format using some scaling factor M > Max of signal (let 1300 > 1290) and 2^31, such as final scaling factor as 2^31/1300 = 16,51,910.
//input signal
for(i=0; i < FFT_SIZE; i++){
ipcbsrc[i] = (long) 1651910* result[i]; //Q31 // Range of the input - 0-1299 (0-1V) => to bring into range of 0-1 divide by 1300 and then to get Q31 format multiply with 2^31 = (approx.) 1651910
}
After performing the the 64 point RFFT -
RFFT32_brev(ipcbsrc, ipcb, FFT_SIZE); // real FFT bit reversing
rfft.ipcbptr = ipcb; // FFT computation buffer
rfft.magptr = ipcbsrc; // Magnitude output buffer
rfft.winptr = (long *)win; // Window coefficient array
rfft.init(&rfft); // Twiddle factor pointer initialization
rfft.calc(&rfft); // Compute the FFT
rfft.split(&rfft); // Post processing to get the correct spectrum
rfft.mag(&rfft); // Q31 format (abs(ipcbsrc)/2^16).^2
Below is the output on ipcbsrc-


As per Fixed Point document -

But I don't see same on the ipcbsrc.
Also, when I am trying to get back the magnitude in the decimal format below is the output for different frequency components -
| Q31 | Decimal(output of FFT) | Decimal(Actual) Input | |
| Dc | 264680099 | 160.2267067 | 645.430303 |
| Fundamental ( 50Hz) | 61190090 | 37.04202408 | 620.6060606 |
| 100Hz | 2450431 | 1.483392558 | 124.1212121 |
| 150Hz | 152972 | 0.092603108 | 31.03030303 |
| 200Hz | 0 | 0 | 0 |
| 250Hz | 24725 | 0.014967522 | 12.41212121 |
decimal output is derived from Q31 output by dividing with initial factor (1651910) used to convert the decimal value to Q31 format.
Can you help me understand why output decimal values are not same as the input decimal inputs.,
Thanks & Regards,
Kuldeep

