Path: news.mathworks.com!not-for-mail
From: "Chen Sagiv" <chensagivron@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Does Matlab do FFT correctly ?
Date: Fri, 2 May 2008 22:09:03 +0000 (UTC)
Organization: Sagiv Enterprises
Lines: 66
Message-ID: <fvg3dv$bjj$1@fred.mathworks.com>
References: <fvfs3j$bnf$1@fred.mathworks.com> <80a6a285-8758-488c-9b98-beed0d03d19e@d45g2000hsc.googlegroups.com>  <e4eb82ac-4ea7-49b7-8cdd-aa427d8b064b@i76g2000hsf.googlegroups.com>
Reply-To: "Chen Sagiv" <chensagivron@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1209766143 11891 172.30.248.37 (2 May 2008 22:09:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 2 May 2008 22:09:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 805005
Xref: news.mathworks.com comp.soft-sys.matlab:466363


Dear Steven,

Thanks, I get your point. 

So, basically this is a matter of how to define the origin, 
and I agree with you that it seems consistent with DFT 
definition. 

Nevertheless, I will have to argue that this point is not 
clear at all. Most people refer only to the abs of the FT 
anyway, and this problem will simply go un-noticed. Only 
when phase is of interest, you really look at this subtle 
point. 

Best,

Chen

 "Steven G. Johnson" <stevenj@alum.mit.edu> wrote in 
message <e4eb82ac-4ea7-49b7-8cdd-
aa427d8b064b@i76g2000hsf.googlegroups.com>...
> On May 2, 5:26 pm, "Chen Sagiv" <chensagiv...@gmail.com> 
wrote:
> > I appreciate your answer, but I am afraid that my 
question
> > is still open. When you run my code, you get an 
imaginary
> > part for the transform that is not supposed to be 
there !!!
> > I still have to check your remark regarding the DFT of a
> > square pulse being the ratio of two sines. Still, I do 
not
> > think that one may expect getting complex value for the
> > Fourier transform.
> 
> Sorry, I thought I had been clear.  Your square pulse is 
not centered
> at the origin (the origin for the DFT is *not* at the 
centered at the
> middle of the array).  Because your pulse is shifted in 
the time
> domain, it gets multiplied by a complex phase in the 
frequency domain
> by the shift theorem.
> 
> Calling ifftshift on the fft input recenters your data 
correctly,
> giving you a real result for the fft.  However, even with 
this you
> have to be careful, because there is some subtletly in 
how ifftshift
> defines the "center" of the array depending upon whether 
the length is
> even or odd.
> 
> Rest assured that Matlab's results are completely correct 
and
> consistent with the standard definition of the DFT.  
Whenever it gives
> you something different from what you expect, you should 
be looking
> for a flaw in your understanding.
> 
> Regards,
> Steven G. Johnson