help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why does invert fft not work?


From: Sergei Steshenko
Subject: Re: why does invert fft not work?
Date: Thu, 25 Nov 2010 04:35:36 -0800 (PST)


--- On Thu, 11/25/10, address@hidden <address@hidden> wrote:

> From: address@hidden <address@hidden>
> Subject: Re: why does invert fft not work?
> To: address@hidden
> Date: Thursday, November 25, 2010, 12:21 AM
> 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
> >
> 
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> 

Have a habit in such cases to write it as

c=1000*real(ifft(b))/sqrt(2);
.

Regards,
  Sergei.


      



reply via email to

[Prev in Thread] Current Thread [Next in Thread]