Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!k10g2000prm.googlegroups.com!not-for-mail
From: NZTideMan <mulgor@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Strange Behavior in Phase Calculation
Date: Wed, 14 May 2008 00:14:12 -0700 (PDT)
Organization: http://groups.google.com
Lines: 76
Message-ID: <5784b2e7-6422-4da5-bbfa-6f93523e0635@k10g2000prm.googlegroups.com>
References: <g0e20u$kmt$1@fred.mathworks.com> <g0e26h$ig$1@fred.mathworks.com>
NNTP-Posting-Host: 202.78.152.105
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1210749252 11921 127.0.0.1 (14 May 2008 07:14:12 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 14 May 2008 07:14:12 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: k10g2000prm.googlegroups.com; posting-host=202.78.152.105; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon; 
X-HTTP-Via: 1.1 nc2 (NetCache NetApp/6.0.5P1)
Xref: news.mathworks.com comp.soft-sys.matlab:468288



On May 14, 6:52=A0pm, "Chen Sagiv" <chensagiv...@gmail.com> wrote:
> "Chen Sagiv" <chensagiv...@gmail.com> wrote in message
>
> <g0e20u$km...@fred.mathworks.com>...
>
>
>
>
>
> > Dear friends,
>
> > I have a strange phenomenon.
> > I have a cosine wave. I take two instances of it.
>
> > I call the first Case 1, where I have 10 cycles of this
> > wave. Case 2 is 10 cycle + one extra point.
>
> > Now, when I calculate the FT of both signals, I get a non
> > zero imaginary value for the second case.
>
> > If I try to calculate the phase, and use either atan,
> > atan2, angle and phase commands I get a linear phase.
>
> > Isn't it Gibberish ? How does Matlab generate linear
> phase
> > when the imaginary part of the FT is practically zero ?
>
> > I would be happy to get comments on this issue.
>
> > Thanks,
>
> > Chen
>
> Sorry, forgot to attach the code:
>
> close all;
> clear all;
>
> % Constants
> T =3D 10;
> w0 =3D 2*pi;
> sigma =3D 1;
> % Case 1: there are 10 cycles of the cosine function
> t1 =3D 0:0.01:10-0.01;
> f1 =3D cos(w0*t1);
> fw1 =3D fftshift(fft(f1));
>
> % Case 2: there are 10 cycles + 1 point
> t2 =3D 0:0.01:10;
> f2 =3D cos(w0*t2);
> fw2 =3D fftshift(fft(f2));
>
> figure ;
> subplot(3,2,1); plot(real(fw1),'.k');
> title('Case 1: real FT');
> subplot(3,2,3); plot(imag(fw1),'.k');
> title('Case 1: imag FT');
> subplot(3,2,5); plot(atan2(imag(fw1), real(fw1)),'.');
> title('Case 1: phase of FT');
> subplot(3,2,2); plot(real(fw2),'.k');
> title('Case 2: real FT');
> subplot(3,2,4); plot(imag(fw2),'.k');
> title('Case 2: imag FT');
> subplot(3,2,6); plot(atan2(imag(fw2), real(fw2)),'.');
> title('Case 2: phase of FT');
>
> Best,
>
> Chen- Hide quoted text -
>
> - Show quoted text -

It's called "leakage".  It's a feature of the FFT, so don't for a
moment think you've discovered something new.
There's a very good explanation in E Oran Brigham's book Fast Fourier
Transform published in 1973.