>>HalfResult determines wheter to take n/2 samples >>from the result (if true)or the whole output (if false). > >>Since the intermediate results seems not to >>be correct (quite disturbing) > >Your intermediate result is definitely not correct if you want all N >outputs. But it would seem to be correct for the =91half results=92 case >for outputs 0 to N/2. Perhaps the value of HalfResult isn't what you >think it is within the function? Find out by printing it out while >within the function. > >Your routine is definitely based on a negative exponent, so your >result should be: >Im: 0,-40i,0,0,0,0,0,40i >Re: all zeros > >It looks like you're getting only half the results with some leftover >intermediate data in the upper part. And note that if you added >(-14.14+34.13i) to (14.14+5.87i), you'd get 40i. It's almost as if >you=92re missing the upper part of the last column of butterflies. > >Given that your forward results are not correct for all N outputs, >it's not surprising that an inverse won't work. You need to get the >outputs shown above before doing the inverse. > >Kevin >You are right, but: 1. HalfResult is always false and I am sure of that because when the function is called I do not pass it a variabile but a constant (false); 2. I am not the author of that fft code, and thus I cannot correct it. That was the best implementation I could find, since it was the only one to give exact results, until... now. Well, the output is almost all correct, but in programming "almost" is a strange thing, because I am used to see something completely wrong or something completely right. I would be glad to see that someone has found a bug in that code...
IFFT is not working
Started by ●April 13, 2009
Reply by ●April 16, 20092009-04-16
Reply by ●April 17, 20092009-04-17
Yes, the output is �almost� correct. I was hoping that it was due to �HalfResult� being wrong, but, as you note, it�s False (which is what it should be). I can only conclude that the code is wrong. Somehow, some way, it is skipping the addition of the 6 and 7 output points that would be needed to make the results correct. That would indicate an indexing problem (e.g.: some variable going from 0 to 5, but missing the 6 and 7 points. Those kind of problems can be difficult to spot and correct. You can try printing out all index values to see the sequence of butterflies performed by the code, and then try to fix the one(s) being skipped. I don�t have a compiler that will run your code, so I�m afraid you�re on your own when trying to debug it. An alternative would be to download the same code from wherever you got it, and see if you clipped or inadvertently modified any of it from what you have now. Another possibility is to find some different code. I think it�s essential that you always have some code that you can trust. That way, when you compare its results to the output of a different program, you know what you should be getting. Kevin