Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!y17g2000yqn.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab,comp.dsp,sci.math.num-analysis
Subject: Re: WARNING: Is there a use for ifft(X,M)?
Date: Sat, 13 Jun 2009 03:28:45 -0700 (PDT)
Organization: http://groups.google.com
Lines: 118
Message-ID: <abdeb4dc-441a-407f-98f2-46dd397fce7b@y17g2000yqn.googlegroups.com>
References: <8c3ffec9-42f0-4ba1-ac3c-f826d56dd963@y7g2000yqa.googlegroups.com> 
	<c751a7c4-04ea-4891-82fd-e538fad25826@c19g2000prh.googlegroups.com> 
	<3605952f-7b12-40e2-a651-863b88f9ae65@z16g2000prd.googlegroups.com>
NNTP-Posting-Host: 77.17.86.98
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1244888926 28721 127.0.0.1 (13 Jun 2009 10:28:46 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 13 Jun 2009 10:28:46 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: y17g2000yqn.googlegroups.com; posting-host=77.17.86.98; 
	posting-account=VAp5gAkAAAAmkCze5hvZtMeedpZWNthI
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET 
	CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:547153 comp.dsp:258711 sci.math.num-analysis:108378


On 12 Jun, 21:30, Greg <he...@alumni.brown.edu> wrote:
> On Jun 12, 3:55 am, dbd <d...@ieee.org> wrote:
>
>
>
>
>
> > On Jun 11, 9:21 pm, Greg Heath <he...@alumni.brown.edu> wrote:
>
> > > This is a followup to the thread "Why is fft(x,M) useful?
>
> > >http://groups.google.com/group/comp.soft-sys.matlab/
> > > msg/2bacfcce9454065e
>
> > > As long as the N components of the time sampled row
> > > vector function x are presented in chronological order,
> > > the use of fft(x,M) as shorthand for the zeropadding
> > > operation fft([x,zeros(1,M-N)]) is relatively
> > > straightforward.
>
> > > In contrast, it has been show in recent posts, e.g.,
>
> > >http://groups.google.com/group/comp.soft-sys.matlab/
> > > msg/a76d7837e3d84bcf?hl=en
>
> > > that when zero padding in the spectral domain, it is
> > > essential to add the zeros so that both the real and
> > > imaginary parts of the result are conjugate symmetric.
> > > When N is even, this results in the insertion of the
> > > zeros within a two part decomposition of the Nyquist
> > > component. However, workarounds are available when
> > > the zeros are placed on either side of the Nyquist
> > > component.
>
> > > The purpose of this thread is to warn potential users
> > > that none of the three techniques in the above reference
> > > involves appending the zeros at the end of the spectrum
> > > obtained from fft(x).
>
> > ,> Therefore, I can find no use for ifft(X,M).
> > ,>
> > ,> Hope this helps.
> > ,>
> > ,> Greg
>
> > I can find no use for mayonnaise, but I don't post a warning to
> > comp.dsp about it.
>
> > Since you have included comp.dsp in this post and I've read the basis
> > of your concern, why do you think those in comp.dsp need to be
> > concerned about maintaining non-zero Nyquist components when
> > interpolating via spectrum zero fill and ifft? Why are you?
>
> > How does this help?
>
> I want all of the experts and nonexperts who read
> comp.dsp to understand that
>
> 1.Using MATLABs dual input option of ifft will not
> return a reasonable interpolation of the time
> function obtained when using the single input version.
> 2. This has nothing to do with Nyquist components.
> 3. I can't think of any scenario where the dual input
> version is of any use at all.
> 4. I think this is serious enough to issue a WARNING.

You're wrong on all accounts:

1) When properly used, IFFT will produce such a result
2) The key is to observe the Nyquist frequency
3) An example is given below
4) Invalidated by items 1) - 3) above.

As for the example, consider the following:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N = 20;
x = sin(2*pi*0.1*reshape(0:N-1,N,1));
X = fft(x);

% At this point we have the original spectrum
% Next, make a copy of this spectrum and remove
% the frequency components above the Nyquist
% frequency:

Xx = X;
Xx(ceil(N/2):end)=0;

% Zero-pad in frequency domain and compute
% corresponding complex-valued time seruies
% by using the 2nd argument to IFFT:

M = 2*length(Xx);
xxc = M/N*ifft(Xx,M);

% Deduce the desired real-valued time serie

xx = 2*real(xxc);

% Plot original and interpolated time series:

tvo = 0:N-1;
tvip = (0:length(xx)-1)/2;

clf
stem(tvip,xx,'r');
hold on
stem(tvo,x,'b')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I think you will find that all the resulting plot
indeed shows an interpolated time series that was
indeed computed by means of zero-padding in frequency
domain, and implemented through IFFT(X,M).

No warning needed.

Rune