[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: why does invert fft not work?

**From**: |
macy |

**Subject**: |
Re: why does invert fft not work? |

**Date**: |
Thu, 25 Nov 2010 00:21:23 -0800 |

**User-agent**: |
SquirrelMail/1.4.21 |

Thanks to all who replied.
ARRRGGGHHH!
What I missed are the small mathematical errors.
Since start with a real function, must come full circle to a real function.
b=sqrt(2)*fft(sn)/1000;
c=1000*ifft(b)/sqrt(2);
then the following 'rounds' off the mathematical errors
c=real(c);
and the process does recreate sn
>* On 24-Nov-2010, address@hidden wrote:*
>
>* | why doesn't the invert fft work?*
>* |*
>* | for example:*
>* | s=sqrt(2)*cos(2*pi()*[1:1000]/1000);*
>* | sn=s+.001*sqrt(1000/2)*randn(1,1000);*
>* | b=sqrt(2)*fft(sn)/1000;*
>* |*
>* | invoking*
>* | snew=ifft(b);*
>* |*
>* | does NOT reproduce sn or s in any way shape or form!*
>* |*
>* | What is going on?*
>
>* Why should it produce sn or s? Given your calculation for b above,*
>* isn't ifft(b) the same as*
>
>* ifft(sqrt(2)*fft(sn)/1000)*
>
>* or*
>
>* ifft(fft(sqrt(2)*sn/1000))*
>
>* ? So if you want to compare to sn, I think you need to compare sn to*
>* 1000*snew/sqrt(2), or snew to sqrt(2)*sn/1000.*
>
>* Here is what I see with Octave 3.2.4:*
>
>* octave:1> s=sqrt(2)*cos(2*pi()*[1:1000]/1000);*
>* octave:2> sn=s+.001*sqrt(1000/2)*randn(1,1000);*
>* octave:3> b=sqrt(2)*fft(sn)/1000;*
>* octave:4> snew=ifft(b);*
>* octave:5> max (abs (1000*snew/sqrt(2)-sn))*
>* ans = 1.5735e-15*
>* octave:6> max (abs (snew-sqrt(2)*sn/1000))*
>* ans = 2.1689e-18*
>
>* jwe*
>