help-octave
[Top][All Lists]

## Re: FFT time-shift/interpolation

 From: Sergei Steshenko Subject: Re: FFT time-shift/interpolation Date: Thu, 16 Apr 2009 17:14:44 -0700 (PDT)

```

--- On Thu, 4/16/09, shivan <address@hidden> wrote:

> From: shivan <address@hidden>
> Subject: FFT time-shift/interpolation
> Date: Thursday, April 16, 2009, 5:13 AM
>
> Hi everybody, I trying to shift (circular) a real signal by
> delta, so I do :
>
> a = [1:10] %as a test
> b = ifft( fft(a) .* exp(-2*i*pi*[0:9]*delta/10))
>
> so, yeah, that's cool. but I'd like to use a non-integer
> delta, like 0.2.
> But of course I'll end up with b being an array with
> imaginary number.
> I could interpolate to get more samples and only pick the
> on I need, but
> it's unpractical for values like 0.3452.
>
> would someone please have an idea?
>
> regards.
> --
> View this message in context:
> http://www.nabble.com/FFT-time-shift-interpolation-tp23076695p23076695.html
> Sent from the Octave - General mailing list archive at
> Nabble.com.
>

Regarding "But of course I'll end up with b being an array with imaginary
number" - why do you think so ?

That is, for a real input sequence the second half of spectrum is complex
conjugate of the first one.

So, apply your time shift (exp(-2*i*pi*[0:9]*delta/10)) to the first half,

and then generate the second half as complex conjugate of the first half, and
then perform the inverse fft (ifft).

Had you been working with, say, FFTW directly, with its half-complex
transforms (real -> complex, filter application, complex -> real), you
wouldn't have had the issue/question in the first place.

I am saying that mathematically it is impossible to obtain complex inverse
FFT result in half-complex transforms - provided you do not do insane
things with DC and highest frequency bin, and compact representation of
data won't even allow you to do these insane things - for example, DC is
always real, as well as Nyquist frequency bin for even number of samples.

The DC bin is always stored as a pure real element, Nyquist frequency bin
is also stored as a pure real element for even number of samples.

Regards,
Sergei.

```

reply via email to