Thread Subject: WARNING: Is there a use for ifft(X,M)?

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg Heath

Date: 12 Jun, 2009 04:21:00

Message: 1 of 29

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

Subject: WARNING: Is there a use for ifft(X,M)?

From: dbd

Date: 12 Jun, 2009 07:55:59

Message: 2 of 29

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?

Dale B Dalrymple

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 12 Jun, 2009 19:30:27

Message: 3 of 29

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.

Hope this helps.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: Matt

Date: 12 Jun, 2009 20:27:02

Message: 4 of 29

Greg Heath <heath@alumni.brown.edu> wrote in message <8c3ffec9-42f0-4ba1-ac3c-f826d56dd963@y7g2000yqa.googlegroups.com>...
 

> 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.

I wouldn't confine this to the spectral domain. Might I not want to interpolate spectral samples using the dual of this technique, by zero-padding in the non-Fourier domain? In this case, the same concerns apply when pre-padding fft() input.

Zero-padding the symmetric sequence [a b c d c b a]
results in
[a b c d c b a 0 0 0 0 ...]
which ruins conjugate symmetry, i.e. b is not the conjugate of 0, etc...


> 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).


What if the spectrum is not obtained from fft(x), but rather by some other means? For example, in MRI, spectral samples are obtained by direct measurement, and not by fft computation.


Also, if I want to convolve two spectra X and Y each of length M, this form still has a use

fft( ifft(X,M).*ifft(Y,M-1))

Can I find an instance where this would be applied? Perhaps to filter noisy spectral estimates...

Subject: WARNING: Is there a use for ifft(X,M)?

From: Matt

Date: 12 Jun, 2009 21:10:21

Message: 5 of 29

Anyway, I think the bottom line is this. Because of duality, it doesn't matter what domain your input data is in (spectral, temporal).

However, if the input data array you are passing, be it to fft() or ifft(), has been "folded" (i.e. shifted so that the sampling origin is at the beginning of the array via ifftshift, circshift or whatever...) then fft(x,M) or ifft(Y,M) are probably not going to implement meaningful zero-padding for you.



 

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 13 Jun, 2009 03:36:19

Message: 6 of 29

1234567890123456789012345678901234567890123456789012345
On Jun 12, 4:27 pm, "Matt " <x...@whatever.com> wrote:
> Greg Heath <he...@alumni.brown.edu> wrote in message > <8c3ffec9-42f0-4ba1-ac3c-f826d56dd...@y7g2000yqa.googlegroups.com>...
> > 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.
>
> I wouldn't confine this to the spectral domain. Might
> I not want to interpolate spectral samples using the
> dual of this technique, by zero-padding in the
> non-Fourier domain? In this case, the same concerns
> apply when pre-padding fft() input.

My oersonal opinion is that the two scenarios should
not be perceived as duals when, in both cases, the
measurements are temporal and spectra are only obtained
via the DFT of measured trmporal data.

In the temporal interpolation case N equally spaced
measurements of complex data are obtained during the
time interval [t1:dt:t2]. However, there is no requirement
that the data have conjugate symmetry nor have a special
position with respect to a fixed time origin that is
independent of the data. When the transform is taken,
the spectral samples are equally spaced on the frequency
interval [0:df:Fs-df] where Fs = 1/dt and df = 1/(t2+dt-t1).
Here the first transform value is always at zero frequency
regardless of any other parameters. In addition, the
transforms of the real and inaginary parts of the original
temporal signal have conjugate symmetry and are assumed
to be periodic with period Fs. The locations of the zero
and maximum frequency components are well defined. When
the spectrum is zeropadded to obtain an interpolated
temporal signal, the zeros must be inserted at a precise
location without disturbing the conjugate symmetry of the
transforms from the real and imaginary parts of the
original temporal signal.

This CANNOT be done using IFFT(FFT(x),M)!

In the spectral interpolation case the same N equally
spaced measurements of complex temporal data are obtained
during the time interval [t1:dt:t2]. Again, there is no
requirement that the data be conjugate symmetric nor
have a special position with respect to a fixed time
origin that is independent of the data. The only
requirement is that the data retain the order in which
they were measured. Therefore when the temporal data is
zeropadded to obtain an interpolated spectrum, the zeros
are naturally appended withinn the time interval
[t2+dt:dt:t1+(M-1)*dt].

This CAN be done using FFT(x,M)!


> Zero-padding the symmetric sequence [a b c d c b a]
> results in
> [a b c d c b a 0 0 0 0 ...]
> which ruins conjugate symmetry, i.e. b is not the conjugate of 0, etc...

That is precisely why you should NOT use ifft(X,M)!

> > 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).
>
> What if the spectrum is not obtained from fft(x), but rather by some other means? For example, in MRI, spectral samples are obtained by direct measurement, and not by fft computation.

In this case it depends on how the spectrum is formatted.
If it is formatted so that ifft(X) produces the temporal
signal,

IFFT(X,M) will probably NOT produce a desirable interpolation.

> Also, if I want to convolve two spectra X and Y each of
> length M,

Do you mean length N (N<M)?

>this form still has a use
>
> fft( ifft(X,M).*ifft(Y,M-1))

1. The convolution length should be 2*M-1. However, can't use
" .* " with different length vectors. Something needs fixing.
2. If X is of length M, ifft(X,M) is identically equal to ifft(X).

> Can I find an instance where this would be applied?
> Perhaps to filter noisy spectral estimates...

OK. I understand your point, but we are concerned with
details. How would you caculate the convolution using
the single input option for ifft?

Hope this helps.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 13 Jun, 2009 03:44:49

Message: 7 of 29

On Jun 12, 5:10 pm, "Matt " <x...@whatever.com> wrote:
> Anyway, I think the bottom line is this. Because of duality, it doesn't matter what domain your input data is in (spectral, temporal).

If the measurements are in the temporal domain for both
temporal and spectral interpolation, then the scenarios should
not be considered dual:

Spectra of the real and imaginary parts of complex temporal
data must have conjugate symmetry,

> However, if the input data array you are passing, be it to fft() or ifft(),  has been "folded" (i.e. shifted so that the sampling origin is at the beginning of the array via ifftshift, circshift or whatever...) then fft(x,M) or ifft(Y,M) are probably not going  to implement meaningful zero-padding for you.

The difference is that ifft operates on folded data and fft does not.
Therefore fft(x,M) is useful whereas ifft(X,M) is not.

Hope this helps.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: dbd

Date: 13 Jun, 2009 05:22:09

Message: 8 of 29


On Jun 12, 12:30 pm, 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.

Since you seem to think that the single input option of Matlab's ifft
can produce an appropriate interpolation and all outputs of the single
input option can be produced with the dual input option with the
correct value of the second input, your statement cannot be true. If
it was your intent to make a true statement, perhaps you meant to say
something like "The default zero-fill behavior of the dual input
option of ifft does not correctly place zeros to support zero-fill
interpolation."

> 2. This has nothing to do with Nyquist components.

You referenced it as an area motivating your concern, but you're
right, it probably isn't relevant to a correct version of the
statement you made in 1.

Then you seem to take it up again in:
On Jun 12, 8:36 pm, Greg <he...@alumni.brown.edu> wrote:
> 1234567890123456789012345678901234567890123456789012345
Why?

.> 3. I can't think of any scenario where the dual input
.> version is of any use at all.

There are others who post on comp.dsp who chose to show no
imagination. Please don't encourage them.

3a. I have a vector V of length n > m. I want to know the ifft of the
first m elements of V. "ifft(V,m)" requires fewer characters to type
than "ifft(V(1:m))".
3b.While using ifft I want to make the code more readable for the
maintenance programmer (me in 6 months). Using the dual input ifft
allows my to explicitly place the size of ifft I am intending to
perform in the second input to allow me to check the correctness of
the size of the vector defined by the complex expression in the first
input.

Scenarios, great or not.

.> 4. I think this is serious enough to issue a WARNING.
.>
.> Hope this helps.
.>
.> Greg

You have found an application where you choose not to use ifft(X,m).
This is not logically equivalent to "There is no use for ifft(X,m)."

Perhaps if we tried: "The default zero-fill capability of the dual
input form of ifft() may not be useful for some purposes", we could
get by with just a "Warning".

Dale B. Dalrymple

Subject: WARNING: Is there a use for ifft(X,M)?

From: Matt

Date: 13 Jun, 2009 08:30:19

Message: 9 of 29

Greg <heath@alumni.brown.edu> wrote in message <4f859cdb-1777-4181-a1be-a71289964dbe@y7g2000yqa.googlegroups.com>...
> On Jun 12, 5:10?pm, "Matt " <x...@whatever.com> wrote:

> The difference is that ifft operates on folded data and fft does not.

No. Just like ifft, fft must operate on folded data if I want its output to be real-valued.

Subject: WARNING: Is there a use for ifft(X,M)?

From: Matt

Date: 13 Jun, 2009 09:32:02

Message: 10 of 29

Greg <heath@alumni.brown.edu> wrote in message <d3a0827b-8314-41df-a587-dde72f81d97c@t16g2000yqi.googlegroups.com>...

> In the spectral interpolation case the same N equally
> spaced measurements of complex temporal data are obtained
> during the time interval [t1:dt:t2]. Again, there is no
> requirement that the data be conjugate symmetric nor
> have a special position with respect to a fixed time
> origin that is independent of the data. The only
> requirement is that the data retain the order in which
> they were measured. Therefore when the temporal data is
> zeropadded to obtain an interpolated spectrum, the zeros
> are naturally appended withinn the time interval
> [t2+dt:dt:t1+(M-1)*dt].

No. Again, this entire debate revolves around your personal notions of when it is and is not relevant to have folded non-Fourier domain data as input to fft().

 If you take the fft of a zero-padded sequence that looks like
 [a b c d e f 0 0 0 0 0,... ],
 then the output will be an approximation to the continuous FT of a continuous signal starting at t=0 and which is zero for negative time.
If that's the continuous signal you are trying to model, then great.

But now lets extend the discussion to fft2(). For people who work with images, the non-Fourier domain data extends over the negative axes as well. The image data I'm trying to transform may be a Gaussian lobe whose peak is in the center of the array. I want its spectrum to be a text book real-valued Gaussian. For this situation, I need to fold the data before passing to fft2().

Yes, it's possible to compensate afterward by multiplying by a linear phase factor, but as I explained to you elsewhere, this is computationally unpreferable. And if I want an upsampled spectrum, I will have to zero-pad symmetrically around the lobe before folding. This will lead to a folded input to fft2() in which the padded zeros are not trailing zeros, i.e. it is NOT equivalent to calling fft2(X,Mrows, Ncols).






 

> > Zero-padding the symmetric sequence [a b c d c b a]
> > results in
> > [a b c d c b a 0 0 0 0 ...]
> > which ruins conjugate symmetry, i.e. b is not the conjugate of 0, etc...
>
> That is precisely why you should NOT use ifft(X,M)!

And if the sequence in my example represents a time domain sequence it is also precisely why you should NOT use fft(X,M).

 

> > Also, if I want to convolve two spectra X and Y each of
> > length M,
>
> Do you mean length N (N<M)?

No, I mean I want to linearly convolve 2 length-M sequences.
 
> >this form still has a use
> >
> > fft( ifft(X,M).*ifft(Y,M-1))
>
> 1. The convolution length should be 2*M-1. However, can't use
> " .* " with different length vectors. Something needs fixing.

OK. Then

fft( ifft(X,M).*ifft(Y,M)),

The point is that there be enough zero-padding that the cyclic convolution be equivalent to linear convolution.

Anyway, it's a moot point. I can implement the same thing as follows

ifft( fft(X,M).*fft(Y,M)),

The point is that ifft(X,M) is no less useful than fft(X,M).

Subject: WARNING: Is there a use for ifft(X,M)?

From: Rune Allnor

Date: 13 Jun, 2009 10:28:45

Message: 11 of 29

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

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 13 Jun, 2009 12:34:14

Message: 12 of 29

On Jun 13, 1:22 am, dbd <d...@ieee.org> wrote:
> On Jun 12, 12:30 pm, 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.
>
> Since you seem to think that the single input option of Matlab's ifft
> can produce an appropriate interpolation and all outputs of the single
> input option can be produced with the dual input option with the
> correct value of the second input, your statement cannot be true. If
> it was your intent to make a true statement, perhaps you meant to say
> something like "The default zero-fill behavior of the dual input
> option of ifft does not correctly place zeros to support zero-fill
> interpolation."

1. When M > N is an integer multiple of N, a reasonable M point
interpolation of the N point temporal function x cannot be
obtained using ifft(fft(x),M). Therefore, when M > N, I cannot
think of a scenario where the dual input option of ifft is
useful.

> > 2. This has nothing to do with Nyquist components.
>
> You referenced it as an area motivating your concern, but you're
> right, it probably isn't relevant to a correct version of the
> statement you made in 1.

2. The cause of the failure is the incorrect placement of the
zeropadding w.r.t the Nyquist frequency.

> Then you seem to take it up again in:
> On Jun 12, 8:36 pm, Greg <he...@alumni.brown.edu> wrote:> 1234567890123456789012345678901234567890123456789012345
>
> Why?
>
> .> 3. I can't think of any scenario where the dual input
> .> version is of any use at all.
>
> There are others who post on comp.dsp who chose to show no
> imagination. Please don't encourage them.
>
> 3a. I have a vector V of length n > m. I want to know the ifft of the
> first m elements of V. "ifft(V,m)" requires fewer characters to type
> than "ifft(V(1:m))".
>
> 3b.While using ifft I want to make the code more readable for the
> maintenance programmer (me in 6 months). Using the dual input ifft
> allows my to explicitly place the size of ifft I am intending to
> perform in the second input to allow me to check the correctness of
> the size of the vector defined by the complex expression in the first
> input.
>
> Scenarios, great or not.

My revision of statement 1 (above) now excludes the M <= N
scenarios.

> .> 4. I think this is serious enough to issue a WARNING.
> .>
> .> Hope this helps.
> .>
> .> Greg
>
> You have found an application where you choose not to use ifft(X,m).
> This is not logically equivalent to "There is no use for ifft(X,m)."
>
> Perhaps if we tried: "The default zero-fill capability of the dual
> input form of ifft() may not be useful for some purposes", we could
> get by with just a "Warning".

Untill I find a practical counterexample, I'll stick with the above
revisions.

In addition, I still think that anyone attempting to use ifft(X,M),
M > N for temporal interpolation should be forewarned.

Hope this helps.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: Matt

Date: 13 Jun, 2009 12:57:01

Message: 13 of 29

Rune Allnor <allnor@tele.ntnu.no> wrote in message <abdeb4dc-441a-407f-98f2-46dd397fce7b@y17g2000yqn.googlegroups.com>...


> % 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;

Not bad, Rune. A couple things though. First, the creation of Xx needs some fixing

Xx = X;
Xx(ceil(N/2)+1:end)=0; %Note the +1

Xx(1)=Xx(1)/2; %Otherwise DC will be double-counted

if ~bitget(N,1) %N is even
 Xx(N/2)=Xx(N/2)/2; %Otherwise Nyqist frequency will be double-counted
end

Secondly, I fear this technique will get rather cumbersome when you go to higher dimensions and extended to fft2 or fftn.

Subject: WARNING: Is there a use for ifft(X,M)?

From: Matt

Date: 13 Jun, 2009 13:09:01

Message: 14 of 29

"Matt " <xys@whatever.com> wrote in message <h107mt$1be$1@fred.mathworks.com>...
> Rune Allnor <allnor@tele.ntnu.no> wrote in message <abdeb4dc-441a-407f-98f2-46dd397fce7b@y17g2000yqn.googlegroups.com>...
>
>
> > % 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;
>
> Not bad, Rune. A couple things though. First, the creation of Xx needs some fixing
>
> Xx = X;
> Xx(ceil(N/2)+1:end)=0; %Note the +1
>
> Xx(1)=Xx(1)/2; %Otherwise DC will be double-counted
>
> if ~bitget(N,1) %N is even
> Xx(N/2)=Xx(N/2)/2; %Otherwise Nyqist frequency will be double-counted
> end
>


Sorry, make that last part as follows

if ~bitget(N,1) %N is even
  Xx(N/2)=X(N/2+1)/2; %Otherwise Nyqist frequency will be double-counted
 end

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 13 Jun, 2009 17:46:11

Message: 15 of 29

On Jun 13, 6:28 am, Rune Allnor <all...@tele.ntnu.no> wrote:
> 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 a response to previous replies, the following is a
revision:

1. When N = length(fft(x)) and M > N is an integer multiple
of N, a reasonable M point interpolation of the arbitrary N
point complex temporal function x cannot be obtained using
ifft(fft(x),M).
2. The inherent cause of failure is the incorrect placement
of the zeropadding w.r.t the Nyquist frequency.
3. When M > N and X = fft(x), the dual input option of
ifft can be used for a reasonable temporal interpolation
only under restricted conditions (e.g. x is either purely
real or purely imaginary without a Nyquist component).
4. The ifft documentation should adequately explain how
to use one and two input option for both the general and
special cases of temporal.

> As for the example, consider the following:

-----SNIPPED EXAMPLE

> 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).

More transparently

xint = IFFT(g(fft(x)),M);

for this special case.

> No warning needed.

That's debatable. See below:

An enlightening but unexceptional example because

1. x is not complex
2. x does not have a Nyquist component

What is needed is an adequate explanation in the ifft
documentation w.r.t. temporal interpolation.

Hope this helps.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: Rune Allnor

Date: 13 Jun, 2009 19:15:56

Message: 16 of 29

On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote:

> More transparently
>
> xint = IFFT(g(fft(x)),M);
>
> for this special case.

No. x[n] is real-valued, which means its spectrum
is conjugate symmetric. Your statement above breaks
that symmetry.

> > No warning needed.
>
> That's debatable. See below:
>
> An enlightening but unexceptional example because
>
> 1. x is not complex

What does that have to do with anything?
If x[n] is complex-valued time domain
interpolation becomes even simpler, as one
can skip the time-domain manipulations
after the IFFT.

> 2. x does not have a Nyquist component

So? If you really want to do time-domain
interpolation through spectrum-domain
manipulations, the handling of a non-zero
Fs/2 coefficient will be debatable no matter
how one chooses to compute the IFFT.

Rune

Subject: WARNING: Is there a use for ifft(X,M)?

From: Matt

Date: 13 Jun, 2009 20:57:01

Message: 17 of 29

Rune Allnor <allnor@tele.ntnu.no> wrote in message <ec89b5e8-0fa6-4bca-9fdf-75f4cc5e5329@c36g2000yqn.googlegroups.com>...

> > 2. x does not have a Nyquist component
>
> So? If you really want to do time-domain
> interpolation through spectrum-domain
> manipulations, the handling of a non-zero
> Fs/2 coefficient will be debatable no matter
> how one chooses to compute the IFFT.

I don't think so. I think we worked it out pretty thoroughly in this thread:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/253061#656994

You have to split the Fs/2 coefficient in half.

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 13 Jun, 2009 22:42:19

Message: 18 of 29

On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote:
>
> > More transparently
>
> > xint = IFFT(g(fft(x)),M);
>
> > for this special case.
>
> No. x[n] is real-valued, which means its spectrum
> is conjugate symmetric. Your statement above breaks
> that symmetry.

I don't understand what you mean. The function g
just stands for whatever you did to X = fft(x)
in order to obtain xint. However, I should amend
that to

xint = real(IFFT(g(fft(x)),M));

> > > No warning needed.
>
> > That's debatable. See below:
>
> > An enlightening but unexceptional example because
>
> > 1. x is not complex
>
> What does that have to do with anything?

You had to take the real part in order to
eliminate a significantly sized imaginary
part.

> If x[n] is complex-valued time domain
> interpolation becomes even simpler, as one
> can skip the time-domain manipulations
> after the IFFT.

I disagree.

> > 2. x does not have a Nyquist component
>
> So? If you really want to do time-domain
> interpolation through spectrum-domain
> manipulations, the handling of a non-zero
> Fs/2 coefficient will be debatable no matter
> how one chooses to compute the IFFT.

Not really.

An excellent test would be to fft a subsample
of a complex temporal function and compare using
the single vs double input versions of ifft for
interpolating the subsample to reconstruct the
original.

My guess is that even experienced users of fft
and ifft would have trouble.

I will post a test example later.

Hope this helps.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 14 Jun, 2009 02:14:16

Message: 19 of 29

On Jun 13, 6:42 pm, Greg <he...@alumni.brown.edu> wrote:
> On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote:
>
> > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote:
>
> > > More transparently
>
> > > xint = IFFT(g(fft(x)),M);
>
> > > for this special case.
>
> > No. x[n] is real-valued, which means its spectrum
> > is conjugate symmetric. Your statement above breaks
> > that symmetry.
>
> I don't understand what you mean. The function g
> just stands for whatever you did to X = fft(x)
> in order to obtain xint. However, I should amend
> that to
>
> xint = real(IFFT(g(fft(x)),M));
>
> > > > No warning needed.
>
> > > That's debatable. See below:
>
> > > An enlightening but unexceptional example because
>
> > > 1. x is not complex
>
> > What does that have to do with anything?
>
> You had to take the real part in order to
> eliminate a significantly sized imaginary
> part.
>
> > If x[n] is complex-valued time domain
> > interpolation becomes even simpler, as one
> > can skip the time-domain manipulations
> > after the IFFT.
>
> I disagree.
>
> > > 2. x does not have a Nyquist component
>
> > So? If you really want to do time-domain
> > interpolation through spectrum-domain
> > manipulations, the handling of a non-zero
> > Fs/2 coefficient will be debatable no matter
> > how one chooses to compute the IFFT.
>
> Not really.
>
> An excellent test would be to fft a subsample
> of a complex temporal function and compare using
> the single vs double input versions of ifft for
> interpolating the subsample to reconstruct the
> original.
>
> My guess is that even experienced users of fft
> and ifft would have trouble.
>
> I will post a test example later.

%Compare the single and double input versions of the ifft
%for recovering the original complex temporal function
%z0 = x0+i*y0 from the subsampled function zs = xs+i*ys.

t0 = (1/16)*(0:15)' ;
x0 = sin((pi/4)*(0:15)').^2 ;
y0 = cos(3*(pi/16)*(0:15)').^2 ;
z0 = x0 + i*y0 ;

ts = (1/8)*(0:7)' ;
xs = sin((pi/2)*(0:7)').^2 ;
ys = cos(3*(pi/8)*(0:7)').^2 ;
zs = xs + i*ys ;

figure
subplot(2,1,1), hold on
plot(t0,x0,'*-')
plot(ts,xs,'r--*')
ylabel('Real Part')
title('Subsampled Function (Red) ')
subplot(2,1,2), hold on
plot(t0,y0,'*-')
plot(ts,ys,'r--*')
ylabel('Imaginary Part)')
xlabel('Time (sec)')

% Insert code

figure
subplot(2,1,1), hold on
plot(t0,x0,'*-')
plot(t0,xint,'r--*')
ylabel('Real Part')
title('Interpolated Function (Red) ')
subplot(2,1,2), hold on
plot(t0,y0,'*-')
plot(t0,yint,'r--*')
ylabel('Imaginary Part)')
xlabel('Time (sec)')

Have fun!

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: Rune Allnor

Date: 14 Jun, 2009 10:35:22

Message: 20 of 29

On 14 Jun, 00:42, Greg <he...@alumni.brown.edu> wrote:
> On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote:
>
> > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote:
>
> > > More transparently
>
> > > xint = IFFT(g(fft(x)),M);
>
> > > for this special case.
>
> > No. x[n] is real-valued, which means its spectrum
> > is conjugate symmetric. Your statement above breaks
> > that symmetry.
>
> I don't understand what you mean. The function g
> just stands for whatever you did to X  = fft(x)
> in order to obtain xint. However, I should amend
> that to
>
> xint = real(IFFT(g(fft(x)),M));

Wrong.

> > > > No warning needed.
>
> > > That's debatable. See below:
>
> > > An enlightening but unexceptional example because
>
> > > 1. x is not complex
>
> > What does that have to do with anything?
>
> You had to take the real part in order to
> eliminate a significantly sized imaginary
> part.

You need to work through *all* the details
in the example, particularly the lines

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

Since x was real-valued, the upper and lower halfs
of the spectrum X are conjugate symmetric. These two
lines make a copy of the conjugate symmetric spectrum,
and then zeros the upper half of that spectrum.

Leaving out the DC and Nyquist componenst, which
need to be treated separately, the net effect of
this operation is that the resulting time-domain
sequence is complex-valued, with a significant
imaginary part.

However, we can repeat the argument, but where
one zeros the lower half of the spectrum and keeps
the upper half.

Ths case, too, will produce a complex-valued time-
domain representation that has a significant imaginary
component. But if you look very closely you will find:

1) The two half-spectra are conjugate symmetric
2) The resulting time series are conjugates of each other
3) The total spectrum is the sum of the two half-spectra
4) The original time series is the sum of two complex
   conjugate time series
5) One can use all these properties to compute the
   real-valued time series from knowledge of only
   one half of the total spectrum.

Which was what I did, after having zero-padded the
half-spectrum.

Rune

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 14 Jun, 2009 15:20:26

Message: 21 of 29

On Jun 14, 6:35 am, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 14 Jun, 00:42, Greg <he...@alumni.brown.edu> wrote:
> > On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote:
> > > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote:
>
> > > > More transparently
>
> > > > xint = IFFT(g(fft(x)),M);
>
> > > > for this special case.
>
> > > No. x[n] is real-valued, which means its spectrum
> > > is conjugate symmetric. Your statement above breaks
> > > that symmetry.
>
> > I don't understand what you mean. The function g
> > just stands for whatever you did to X = fft(x)
> > in order to obtain xint. However, I should amend
> > that to
>
> > xint = real(IFFT(g(fft(x)),M));
>
> Wrong.
>
> > > > > No warning needed.
>
> > > > That's debatable. See below:
>
> > > > An enlightening but unexceptional example because
>
> > > > 1. x is not complex
>
> > > What does that have to do with anything?
>
> > You had to take the real part in order to
> > eliminate a significantly sized imaginary
> > part.
>
> You need to work through *all* the details
> in the example, particularly the lines
>
> Xx = X;
> Xx(ceil(N/2):end)=0;
>
> Since x was real-valued, the upper and lower halfs
> of the spectrum X are conjugate symmetric. These two
> lines make a copy of the conjugate symmetric spectrum,
> and then zeros the upper half of that spectrum.

What you have written only applies when
1. x is real
2. The Nyquist component X(N/2+1) is zero
3. The frequency component below Nyquist X(N/2) is zero

In other words, you have chopped off two components
that are already zero in this unexceptional example,
but are sugnificant in the example that I just posted.

> Leaving out the DC and Nyquist componenst,

Your statement does not eliminate the DC component X(1).
However, there is no DC in your example.

> which
> need to be treated separately, the net effect of
> this operation is that the resulting time-domain
> sequence is complex-valued, with a significant
> imaginary part.

I understand that... and that is why you have to take
the real part at the end.

> However, we can repeat the argument, but where
> one zeros the lower half of the spectrum and keeps
> the upper half.

How you treat the Nyquist component is critical.
However, there is no Nyquist component in your example.

> Ths case, too, will produce a complex-valued time-gnificant
> imaginary component. But if you look very closely you
> will find:
>
> 1) The two half-spectra are conjugate symmetric
> 2) The resulting time series are conjugates of each other
> 3) The total spectrum is the sum of the two half-spectra
> 4) The original time series is the sum of two complex
> conjugate time series
> 5) One can use all these properties to compute the
> real-valued time series from knowledge of only
> one half of the total spectrum.
>
> Which was what I did, after having zero-padded the
> half-spectrum.

This procedure will not work in the general case.
See the example I posted.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: Rune Allnor

Date: 14 Jun, 2009 15:45:04

Message: 22 of 29

On 14 Jun, 17:20, Greg <he...@alumni.brown.edu> wrote:
> On Jun 14, 6:35 am, Rune Allnor <all...@tele.ntnu.no> wrote:
>
>
>
>
>
> > On 14 Jun, 00:42, Greg <he...@alumni.brown.edu> wrote:
> > > On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote:
> > > > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote:
>
> > > > > More transparently
>
> > > > > xint = IFFT(g(fft(x)),M);
>
> > > > > for this special case.
>
> > > > No. x[n] is real-valued, which means its spectrum
> > > > is conjugate symmetric. Your statement above breaks
> > > > that symmetry.
>
> > > I don't understand what you mean. The function g
> > > just stands for whatever you did to X  = fft(x)
> > > in order to obtain xint. However, I should amend
> > > that to
>
> > > xint = real(IFFT(g(fft(x)),M));
>
> > Wrong.
>
> > > > > > No warning needed.
>
> > > > > That's debatable. See below:
>
> > > > > An enlightening but unexceptional example because
>
> > > > > 1. x is not complex
>
> > > > What does that have to do with anything?
>
> > > You had to take the real part in order to
> > > eliminate a significantly sized imaginary
> > > part.
>
> > You need to work through *all* the details
> > in the example, particularly the lines
>
> > Xx = X;
> > Xx(ceil(N/2):end)=0;
>
> > Since x was real-valued, the upper and lower halfs
> > of the spectrum X are conjugate symmetric. These two
> > lines make a copy of the conjugate symmetric spectrum,
> > and then zeros the upper half of that spectrum.
>
> What you have written only applies when
> 1. x is real

Nope. Interpolation by zero-padding in frequency
domain is trival when x is complex-valued.

> 2. The Nyquist component X(N/2+1) is zero

It is not obvious how to handle a non-zero coefficient
at the Nyquist frequency. But that has nothing to do
with where and how you insert the zeros, it has to
do with fundamental properties of the DFT.

> 3. The frequency component below Nyquist X(N/2) is zero

This is plain wrong.

> In other words, you have chopped off two components
> that are already zero in this unexceptional example,
> but are sugnificant in the example that I just posted.

I don't care about the example you posted. You haven't
understood what is a standard technique in DSP. Look up
I/Q sampling.

> > Leaving out the DC and Nyquist componenst,
>
> Your statement does not eliminate the DC component X(1).
> However, there is no DC in your example.

The DC and F_Nyquist components have to be treated
separately. They are the only ones that do not
have conjugate symmetric counterparts. It's just
a matter of book-keeping.

> > which
> > need to be treated separately, the net effect of
> > this operation is that the resulting time-domain
> > sequence is complex-valued, with a significant
> > imaginary part.
>
> I understand that... and that is why you have to take
> the real part at the end.
>
> > However, we can repeat the argument, but where
> > one zeros the lower half of the spectrum and keeps
> > the upper half.
>
> How you treat the Nyquist component is critical.
> However, there is no Nyquist component in your example.

C'mon, Greg. You started this thread on the false
assumption that there is no use for the IFFT(X,M)
function. I proved you wrong. Why don't you just
leave it there. Don't pretend that the Nyquist
coefficient has anything at all to do with where
this started.

Rune

Subject: WARNING: Is there a use for ifft(X,M)?

From: Steve Amphlett

Date: 14 Jun, 2009 16:47:01

Message: 23 of 29

Rune Allnor <allnor@tele.ntnu.no> wrote in message <28da55a9-7b3c-456b-aebd-6532ad4792ad@h11g2000yqb.googlegroups.com>...

> The DC and F_Nyquist components have to be treated
> separately. They are the only ones that do not
> have conjugate symmetric counterparts. It's just
> a matter of book-keeping.

Book-keeping, understanding and testing your understanding by sending in your own trivial inputs.

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 14 Jun, 2009 17:48:58

Message: 24 of 29

On Jun 14, 11:45 am, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 14 Jun, 17:20, Greg <he...@alumni.brown.edu> wrote:
> > On Jun 14, 6:35 am, Rune Allnor <all...@tele.ntnu.no> wrote:
> > > On 14 Jun, 00:42, Greg <he...@alumni.brown.edu> wrote:
> > > > On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote:
> > > > > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote:
>
> > > > > > More transparently
>
> > > > > > xint = IFFT(g(fft(x)),M);
>
> > > > > > for this special case.
>
> > > > > No. x[n] is real-valued, which means its spectrum
> > > > > is conjugate symmetric. Your statement above breaks
> > > > > that symmetry.
>
> > > > I don't understand what you mean. The function g
> > > > just stands for whatever you did to X = fft(x)
> > > > in order to obtain xint. However, I should amend
> > > > that to
>
> > > > xint = real(IFFT(g(fft(x)),M));
>
> > > Wrong.

Wrong?
That expains EXACTLY what you did!
1. You fooled around with fft(x)
2. You took the ifft using the dual input option
3. You took the real part.

> > > > > > > No warning needed.
>
> > > > > > That's debatable. See below:
>
> > > > > > An enlightening but unexceptional example because
>
> > > > > > 1. x is not complex
>
> > > > > What does that have to do with anything?
>
> > > > You had to take the real part in order to
> > > > eliminate a significantly sized imaginary
> > > > part.
>
> > > You need to work through *all* the details
> > > in the example, particularly the lines
>
> > > Xx = X;
> > > Xx(ceil(N/2):end)=0;
>
> > > Since x was real-valued, the upper and lower halfs
> > > of the spectrum X are conjugate symmetric. These two
> > > lines make a copy of the conjugate symmetric spectrum,
> > > and then zeros the upper half of that spectrum.
>
> > What you have written only applies when
> > 1. x is real
>
> Nope. Interpolation by zero-padding in frequency
> domain is trival when x is complex-valued.

Talk is cheap. See my complex-valued example.

> > 2. The Nyquist component X(N/2+1) is zero
>
> It is not obvious how to handle a non-zero coefficient
> at the Nyquist frequency.

That is why I posted three ways in the other thread.
None of them use the dual input option.

> But that has nothing to do
> with where and how you insert the zeros,

It has EVERYTHING to do with where you place the zeros.

> it has to
> do with fundamental properties of the DFT.

Indeed. It is those fundamental properties that dictate
where you can place the zeros.

> > 3. The frequency component below Nyquist X(N/2) is zero
>
> This is plain wrong.

I interpret

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

to include

Xx(N/2+1) = 0 % Nyquist
Xx(N/2) = 0 % Component below Nyquist

When x is real Xx is conjugate symmetric and all
info is preserved via

Xx(ceil((N+3)/2):end) = 0

> > In other words, you have chopped off two components
> > that are already zero in this unexceptional example,
> > but are sugnificant in the example that I just posted.
>
> I don't care about the example you posted.

Too bad. If you tried it you would probably learn something.

> You haven't understood what is a standard technique in DSP.

I understand it perfectly. I'm just trying to point out
flaws in common understanding. In particular, when M > N,
x is complex valued and X = fft(x) has a nonnegligible
Nyquist component, the proper interpolation of x is
challenging using the single input version of the ifft.
However, trying to use the double input version is
ridiculously more complicated.

> Look up I/Q sampling.
>
> > > Leaving out the DC and Nyquist componenst,
>
> > Your statement does not eliminate the DC component X(1).
> > However, there is no DC in your example.
>
> The DC and F_Nyquist components have to be treated
> separately. They are the only ones that do not
> have conjugate symmetric counterparts. It's just
> a matter of book-keeping.

The three single input methods I posted don't need
to treat DC separately. I don't see why you have to
either. Is it because you are using a second input?
Since your example doesn't have DC it is not clear
what you are implying.

> > > which
> > > need to be treated separately, the net effect of
> > > this operation is that the resulting time-domain
> > > sequence is complex-valued, with a significant
> > > imaginary part.
>
> > I understand that... and that is why you have to take
> > the real part at the end.
>
> > > However, we can repeat the argument, but where
> > > one zeros the lower half of the spectrum and keeps
> > > the upper half.
>
> > How you treat the Nyquist component is critical.
> > However, there is no Nyquist component in your example.
>
> C'mon, Greg. You started this thread on the false
> assumption that there is no use for the IFFT(X,M)
> function. I proved you wrong.

No. You did not.

What you did will not work on the complex example
that I posted.

> leave it there. Don't pretend that the Nyquist
> coefficient has anything at all to do with where
> this started.

Pretend? What are you smoking?

... and where can I get some?

I'm tired of talking past each other. Just try
the double input version of ifft on the example I
posted. It poses challenges that are missing in your
example.

Hope this helps.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 21 Jun, 2009 10:41:34

Message: 25 of 29

On Jun 13, 10:14 pm, Greg <he...@alumni.brown.edu> wrote:
> On Jun 13, 6:42 pm,Greg<he...@alumni.brown.edu> wrote:

> > An excellent test would be to fft a subsample
> > of a complex temporal function and compare using
> > the single vs double input versions of ifft for
> > interpolating the subsample to reconstruct the
> > original.
>
> > My guess is that even experienced users of fft
> > and ifft would have trouble.
>
> > I will post a test example later.
>
> %Compare the single and double input versions of the ifft
> %for recovering the original complex temporal function
> %z0 = x0+i*y0 from the subsampled function zs = xs+i*ys.

Well, since no one replied, and I can't see how to do it,
I'll conclude that when zs is complex with a significant
Nyquist component, the double input version of ifft is
useless for reconstructing z0 via Fourier interpolation.

Temporal Fourier Interpolation using the single input
version is illustrated below:

close all, clear all, clc

% A complex time function with a significant Nyquist
% component

% Sampled Function zs

T = 1, Ns = 8
dts = T/Ns, ts = dts*(0:Ns-1)';
df = 1/T, f = df*(0:Ns-1)';
zs = complex(sin(pi* (Ns/2)*df *dts*(0:Ns-1)').^2,...
      cos(pi*(Ns/2-1)*df *dts*(0:Ns-1)').^2);
Zs = fft(zs);

% Original Function z0

M = 4*Ns
dt = T/M, t = dt*(0:M-1)';
z0 = complex(sin(pi* (Ns/2)*df *dt*(0:M-1)').^2,...
     cos(pi*(Ns/2-1)*df *dt*(0:M-1)').^2);

% Interpolated Function z

Z = (M/Ns)*[Zs(1:Ns/2);Zs(Ns/2+1)/2;zeros(M-Ns-1,1); ...
             Zs(Ns/2+1)/2;Zs(Ns/2+2:Ns)];
z = ifft(Z);

err = maxabs(z-z0) % 1.3369e-015

x0 = real(z0); y0 = imag(z0);

k=k+1, figure(k)
subplot(2,2,1), hold on
plot(t,x0,'*-')
plot(ts,real(zs),'r--*')
ylabel('Real Part')
title('Original (Blue) and Subsampled (Red)')

subplot(2,2,3), hold on
plot(t,y0,'*-')
plot(ts,imag(zs),'r--*')
ylabel('Imaginary Part)')
xlabel('Time (sec)')

subplot(2,2,2), hold on
plot(t,x0,'*-')
plot(t,real(z),'r--*')
ylabel('Real Part')
title('Original (Blue) and Interpolated (Red)')

subplot(2,2,4), hold on
plot(t,y0,'*-')
plot(t,imag(z),'r--*')
ylabel('Imaginary Part)')
xlabel('Time (sec)')

Hope this helps.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: dbd

Date: 21 Jun, 2009 15:34:20

Message: 26 of 29

On Jun 21, 3:41 am, Greg <he...@alumni.brown.edu> wrote:
> On Jun 13, 10:14 pm, Greg <he...@alumni.brown.edu> wrote:
> ...


.> Well, since no one replied, and I can't see how to do it,
.> I'll conclude that ...

Assumption of disproof by disinterest and inability is the illogical
resort of trolls, Chicken-Littles and Usenet wannabe mathematicians.

An alternate interpretation of the lack of response in the last week
(even from any of the cross-posted groups) to your approach to the
topic of this thread is that readers have determined your attempt at
'help' to not be of any.
> ...
> Hope this helps.
> Greg

Dale B. Dalrymple

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 22 Jun, 2009 15:50:51

Message: 27 of 29

On Jun 21, 11:34 am, dbd <d...@ieee.org> wrote:
> On Jun 21, 3:41 am, Greg <he...@alumni.brown.edu> wrote:
>
> > On Jun 13, 10:14 pm, Greg <he...@alumni.brown.edu> wrote:
> > ...
>
> .> Well, since no one replied, and I can't see how to do it,
> .> I'll conclude that ...
>
> Assumption of disproof by disinterest and inability is the illogical

I assumed you could impute the missing smiley.

> resort of trolls, Chicken-Littles

OK, I shouldn't have used "WARNING".

and Usenet wannabe mathematicians.

No, never wanted to be.

> An alternate interpretation of the lack of response in the last week
> (even from any of the cross-posted groups) to your approach to the
> topic of this thread is that readers have determined your attempt at
> 'help' to not be of any.

I appreciate your acknowledgement that I was trying to help.

What was really bothering me was that, in the past I had recommended
the use of ifft for temporal interpolation without giving any details
or actually
using the MATLAB dual-input implementation myself. In a recent thread
a
stubborn OP pressed for details of Fourier Interpolation. When others
and
me got into it, it became apparent that details were subtle and the
MATLAB
implementation warranted better documentation.

Obviously, my approach to bringing it to the attentrion of others was
ill-founded.

Nevertheless, the problem w.r.t. temporal interpolation still remains.
A nonexpert
would most likely make two faux pas:

1. For practical work, neglect to use windowing to make the Nyquist
component
insignificant.
2. Use xint = ifft(fft(x),M), M = integer*length(x)

Obviously this does not work. Consequently those who would try this
approach should be advised somehow in the documentation.

If you can get past my original smart-ass approach to the problem, do
you think
my concern is warranted? ... or do I have to stand in the corner with
Chicken-Little?

Hope this helps.

Greg

Subject: WARNING: Is there a use for ifft(X,M)?

From: dbd

Date: 22 Jun, 2009 17:05:34

Message: 28 of 29

On Jun 22, 8:50 am, Greg <he...@alumni.brown.edu> wrote:
> ...

> If you can get past my original smart-ass approach to the problem, do
> you think
> my concern is warranted? ... or do I have to stand in the corner with
> Chicken-Little?
>
> Hope this helps.
>
> Greg

OPs who post "WARNINGS" shouldn't expect Usenet readers to supply
smileys they have left out.

I think the world will little note, nor long remember your narrow
concern about ifft.

The reason you are more concerned than the rest of the world seems to
be that you've caught yourself in a recommendation that didn't work
out the way you expected. That's not such big news. The cure for it if
you do want to be helpful is to not make recommendations without
adequate evaluation or applicable experience. If you haven't flown it,
fly it before you tell others to buy it.

Who put you in a corner? I always thought Chicken Little was a free
range chicken.

Dale B. Dalrymple

Subject: WARNING: Is there a use for ifft(X,M)?

From: Greg

Date: 24 Jun, 2009 13:40:19

Message: 29 of 29

On Jun 22, 1:05 pm, dbd <d...@ieee.org> wrote:
> On Jun 22, 8:50 am, Greg <he...@alumni.brown.edu> wrote:
>
> > ...
> > If you can get past my original smart-ass approach to the problem, do
> > you think
> > my concern is warranted? ... or do I have to stand in the corner with
> > Chicken-Little?
>
> > Hope this helps.
>
> > Greg
>
> OPs who post "WARNINGS" shouldn't expect Usenet readers to supply
> smileys they have left out.

Thanks for the warning.

> I think the world will little note, nor long remember your narrow
> concern about ifft.

Right now it looks like the cardinality of the concerned
world is two, soon to be decreased to one.

> The reason you are more concerned than the rest of the world seems to
> be that you've caught yourself in a recommendation that didn't work
> out the way you expected. That's not such big news. The cure for it if
> you do want to be helpful is to not make recommendations without
> adequate evaluation or applicable experience. If you haven't flown it,
> fly it before you tell others to buy it.

I have used fft and ifft for spectral and temporal
interpolation quite a bit. However, I have always
used the single input option with the zeros explicitly
augmenting the original function. It was only when
an OP stubbornly pursued the use of the dual input
version that I became shocked and awed at the lack
of adequate online help for the task.

As two posters have replied: there is a use for the
double input version. However, it is not for temporal
interpolation.

> Who put you in a corner?

No one. Just a fear remnant from the 1st day of the
5th grade after watching a classmate humiliated
by being sent to the the corner wearing a dunce cap
and the bubblegum he was chewwing stuck to his nose.

> I always thought Chicken Little was a free
> range chicken.

Those were the pre-barbecue days.

Greg

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
ifft Sprinceana 22 Jun, 2009 12:15:34
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com