Path: news.mathworks.com!not-for-mail
From: "Chen Sagiv" <chensagivron@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: time and frequency domain
Date: Mon, 12 May 2008 08:13:03 +0000 (UTC)
Organization: Image Processing &#38; Math More
Lines: 111
Message-ID: <g08u6f$sfb$1@fred.mathworks.com>
References: <g03rl9$2pf$1@fred.mathworks.com> <g03tua$bpi$1@fred.mathworks.com>  <0d25ec05-ce98-47fa-868e-d33bb49dfec8@f36g2000hsa.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 1210579983 29163 172.30.248.37 (12 May 2008 08:13:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 12 May 2008 08:13:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 805005
Xref: news.mathworks.com comp.soft-sys.matlab:467859


Greg Heath <heath@alumni.brown.edu> wrote in message 
<0d25ec05-ce98-47fa-868e-
d33bb49dfec8@f36g2000hsa.googlegroups.com>...
> On May 11, 9:26=A0am, "Chen Sagiv" 
<chensagiv...@gmail.com> wrote:
> > Greg Heath <he...@alumni.brown.edu> wrote in message
> >
> > <97e5fc3c-ddbc-4c0c-abd9-
> > c52e9a3ea...@s50g2000hsb.googlegroups.com>...
> >
> > > Corrected for the unforgivable sin of TOP-POSTING!
> >
> > > On May 11, 7:00=3DA0am, "Chen Sagiv"
> > <chensagiv...@gmail.com> wrote:
> > > > Greg Heath <he...@alumni.brown.edu> wrote in message
> >
> > > > <3c59d7c3-618b-44c2-816a-
> > > > b58be9319...@24g2000hsh.googlegroups.com>...
> >
> > > > > On May 10, 3:58=3D3DA0pm, "Chen Sagiv"
> > > > <chensagiv...@gmail.com> wrote:
> > > > > > Hi,
> >
> > > > > > It is not important when you plot the abs of the
> > FT, but
> > > > > > shouldn't you use instead:
> >
> > > > > > > f1 =3D3D3D zeros(1,512);
> > > > > > > f1(128:383) =3D3D3D hamming(256);
> >
> > > > > > > f2 =3D3D3D zeros(1,512);
> > > > > > > f2(128:383) =3D3D3D 1;
> >
> > > > > > > fft_f1 =3D3D3D fftshift(fft(ifftshift
(f1),2048));
> > > > > > > fft_f2 =3D3D3D fftshift(fft(ifftshift
(f2),2048));
> >
> > > > > Absolutely not!
> >
> > > > > Hope this helps.
> >
> > > > Hi Greg,
> >
> > > > No, it doesn't help. Can you explain your very short
> > > > response ?
> >
> > > There is no point to using ifftshift.
> >
> > > When I ran your code the spectra exhibted hashy
> > > artifacts.
> >
> > > Did you cut what you wrote, =A0paste it into a command
> > > =A0line, and compare the plots with the originals??
> >
> > > The results are obviously incorrect.
> 
> > Dear Greg,
> >
> > I refer you to a previous discussion at:
> >
> > 
http://www.mathworks.com/matlabcentral/newsreader/view_threa
> > d/168642#430044
> 
> Let me repeat
> 
> When I ran your code the spectra exhibted hashy
> artifacts. Did you actually run it??
> 
> I read the reference thread. What is your point?
> 
> Greg
> 
> P.S. You may want to take a look at
> 
> fftshift([0 1 2 3 4 5 6 7])
> ifftshift([0 1 2 3 4 5 6 7])
> fftshift([0 1 2 3 4 5 6 7 8])
> ifftshift([0 1 2 3 4 5 6 7 8])

Hi Greg,

I ran the code, and indeed it looks nasty. 
My point is however very simple. 

If you take the code suggested in the beginning of this all 
discussion and display the imaginary rather the abs value 
you will get a phase, which you should be aware of if you 
account for the real and imaginary values of the FT 
separately. This is my point !

Try out:

f1 = zeros(1,512);
f1(128:383) = hamming(256);

f2 = zeros(1,512);
f2(128:383) = 1;

fft_f1 = fftshift(fft(f1,2048));
fft_f2 = fftshift(fft(f2,2048));

subplot(2,2,3); plot(f1);
subplot(2,2,1); plot(f2);
subplot(2,2,4); plot(imag(fft_f1)); xlim([896 1151])
subplot(2,2,2); plot(imag(fft_f2)); xlim([896 1151])

Best,

Chen