When i use the function-dfr16RFFT in PE to execute a FFT. It doesn't work well,Although i strictly follow the instructions of PE's manual ,It does not work well . My code goes following . i'm wondering what's wrong with it ? does Anyone can give me an example of the function dfr16RFFT which give the same result of the answer from Matlab "fft([0.1 0.2 0.3 0.4],8)"

ans =

1.0000

-0.0414 + 0.7243i

-0.2000 - 0.2000i

0.2414 + 0.1243i

-0.2000

0.2414 - 0.1243i

-0.2000 + 0.2000i

-0.0414 - 0.7243i

Thanks A lot!!!!!!!

==============

void main(void)

{

/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

/*** End of Processor Expert internal initialization. ***/

/* Write your code here */

dfr16_tRFFTStruct *pRFFT;

Result res;

Frac16 pX[]={FRAC16(0.1),FRAC16(0.2),FRAC16(0.3),FRAC16(0.4)};

UInt16 options = FFT_SCALE_RESULTS_BY_N;

dfr16_sInplaceCRFFT *pZ=malloc(sizeof(dfr16_sInplaceCRFFT));

PE_low_level_init();

pRFFT = dfr16RFFTCreate (8, options); /* N = 8 point RFFT */

res = dfr16RFFT (pRFFT, pX, pZ);

dfr16RFFTDestroy (pRFFT);

for(;

{}

}

=====================

What do you mean by "it does not work well"? Do you mean it is not as accurate as Matlab? Or do you mean that it takes a lot of coffee breaks and complains a lot? (I do when I have to do an FFT).

Matlab is going to give you a very accurate answer, but a 16-bit fraction is not. The resolution of a 16-bit fraction is approximately 0.00003, ranging from -1.0 to almost 1.0 (actually, 0.99997). When you consider what happens to the coefficients and with all of the multiplications, you can't expect much accuracy. But what you are getting is speed.

If your problem is not with the accuracy, then never mind . . .

Hope that helps.