DSPRelated.com
Forums

How to interpolation in frequency domain will not affect time domain signal?

Started by coly June 30, 2009
Hi, everyone!

I am new in this group. a N-point spectrum was obtained after FFT to
N-point sampled sine signal. But the sampling frequency is not big enough
to distinguish close peaks, I try to interpolate in the N-point spectrum to
achieve a 2N-point spectrum which will increase resolution. the
interpolation goes on like zooming out vector graphics. My problem is that
when I iFFT the interpolated spectrum, what I have achieved is not a sine
signal, the signal has been distorted.

So I am puzzled that how to interpolate in frequency domain will get a
"normal" signal the same as original signal of the orignal spectrum before
interpolation.    


On Jun 30, 10:02&#4294967295;pm, "coly" <wolon...@gmail.com> wrote:
> Hi, everyone! > > I am new in this group. a N-point spectrum was obtained after FFT to > N-point sampled sine signal. But the sampling frequency is not big enough > to distinguish close peaks, I try to interpolate in the N-point spectrum to > achieve a 2N-point spectrum which will increase resolution. the > interpolation goes on like zooming out vector graphics. My problem is that > when I iFFT the interpolated spectrum, what I have achieved is not a sine > signal, the signal has been distorted. > > So I am puzzled that how to interpolate in frequency domain will get a > "normal" signal the same as original signal of the orignal spectrum before > interpolation. &#4294967295; &#4294967295;
First of all, you may be zero padding incorrectly. When zero padding in the frequency domain, you add the zeros BETWEEN the N/2 and N/2 + 1 points. For example, if you have 8 points of a saw tooth waveform in time (n, re, im): 0 1.100000 0.000000 1 2.542809 0.000000 2 1.766667 0.000000 3 1.542809 0.000000 4 1.100000 0.000000 5 0.657191 0.000000 6 0.433333 0.000000 7 -0.342809 0.000000 And you transform it, you get (n re, im): 0 1.100000 0.000000 1 -0.000000 -0.500000 2 0.000000 -0.250000 3 0.000000 -0.166667 4 0.000000 0.000000 5 -0.000000 0.166667 6 -0.000000 0.250000 7 -0.000000 0.500000 To zero pad it to 16 points, add 8 zeros after the N/2 point: 0 1.100000 0.000000 1 -0.000000 -0.500000 2 0.000000 -0.250000 3 0.000000 -0.166667 4 0.000000 0.000000 5 0.000000 0.000000 6 0.000000 0.000000 7 0.000000 0.000000 8 0.000000 0.000000 9 0.000000 0.000000 10 0.000000 0.000000 11 0.000000 0.000000 12 0.000000 0.000000 13 -0.000000 0.166667 14 -0.000000 0.250000 15 -0.000000 0.500000 Note that the above has conjugate symmetry, so when you inverse transform it, you get a real waveform. There's a special problem when, after computing the forward FFT (N an even number), you have a non-zero N/2 point. It has to be treated a bit differently. In that case, you split up the N/2 point into 2 parts. For instance, in the above example, if, after the FFT, you had a value of .2 in the real part of the N/2 result, you'd zero pad, and then split up the N/2 point and use .1 in the real part of point 4, and .1 in the real part of point 12. Your zero padded result will also be conjugate symmetric. After zero padding and inverse transforming, your results may still not be quite as accurate as you think they should be. That's because you're starting from a mistaken premise about zero padding. Consider a time domain signal. If you have 2 sine waves in an input, say at f = 1 cps and another at f = 1.1 cps, then you can only distinguish the 2 in the frequency domain if your frequency spacing of FFT outputs is LESS THAN sample rate/N = .1 Equivalently, you have to make your sampling interval N/sample rate = .1 sec. OR LONGER. The sampling interval is the length of time over which you collect your N samples, and, as you can see, it's the inverse of the frequency spacing of FFT outputs. If you have a single sinusoid in the input, your choices of both sample rate and N will still affect your results. If your sampling interval isn't long enough, then you may end up with 1./2 or 3/4 cycles of the sine wave in the input, and the FFT result will exhibit lots of leakage, and the spectral estimate will be severely distorted. Some beginners mistakenly believe that by zero padding your data, you are somehow making up for the lack of a longer sampling interval, and you'll get more 'resolution' in your results. That belief is completely wrong. If your sampling interval is not long enough, you will obtain a very corrupted spectral result. By zero padding your data, you simply get more (that is, interpolated) points OF THE SAME CRAPPY RESULT. N points of garbage zero padded to 2N points gives you 2N points of garbage in the frequency domain (or time domain, depending on where you're doing the zero padding). You probably need to understand a bit more about DFT and convolution to fully appreciate things. For instance using the DFT on a time domain input, you'd take your N point time data and use a fractional frequency index 'k' to compute as many billion gazillion points as you want in the frequency domain (e.g.: start with k = 0, the k = . 0000000000000001, then k =.0000000000000002, etc.). Or zero pad your FFT out to a billion gazillion points. Either way, it won't matter. Zero padding does NOT improve resolution. It does an interpolation, and that's an entirely different thing. If you understand convolution, then you'd appreciate how shorter and shorter sampling intervals produce more and more corruption in the frequency domain. If you start with an insufficient input data set, you get a bad result. Zero padding your insufficient data doesn't give you a 'better' answer, just more interpolated points of a bad one. There are in fact ways of improving resolution, but some of the techniques are a bit advanced. For a beginner, you may want to look into how windowing your input data may be able reduce some of the leakage problems exhibited when trying to interpret your frequency domain results. You're starting with the incorrect premise that zero padding will make up for a too short sampling interval. It won't. Kevin
Correction:

Consider a time domain signal.  If you have 2 sine waves in an input,
say at f = 1 cps and another at f = 1.1 cps, then you can only
distinguish the 2 in the frequency domain if your frequency spacing
of
FFT outputs is sample rate/N = .1 OR LESS. Equivalently, you have to
make your sampling interval N/sample rate = 1/.1 = 10 sec. OR LONGER.

One of these days I'll learn to divide properly.

Kevin

On 1 Jul, 04:02, "coly" <wolon...@gmail.com> wrote:
> Hi, everyone! > > I am new in this group. a N-point spectrum was obtained after FFT to > N-point sampled sine signal. But the sampling frequency is not big enough > to distinguish close peaks, I try to interpolate in the N-point spectrum to > achieve a 2N-point spectrum which will increase resolution.
Technically speaking, you want to do zero-padding in time domain to get narrower bin-widths in the frequency domain. However, this does not solve what seems to be your main problem, separating two narrow peaks in the spectrum. The only way you can do tha by means of DFTs is to increase the amount of actual data before computing the DFT. Zero-padding doesn't help, as it odes not introduce new information into the signal. Increasing the sampling frequency odesn't help, as the information added by sampling the timne signal denser is spent on computing spectrum coefficients in higher frequency bands. You need more data samples to resolve the peaks. Or you might try frequency estimators. Rune
Maybe I have not discribed clearly.

I agree with you all that zero-padding doesn't improve the resolution of a
spectrum.

But what puzzled me is that my interpolation method in the spectrum leads
to 
a distorted time data. I want to know why. Firstly, I discribe my
interpolation method as follows, similar to zooming out operation. Can you
depict what the time domain data like after this interpolation.
----------------------------------------------------------------------------
I interpolate the spectrum

from N points(x(n), 0<= n < N) to M (y(n), 0<= n < M) points and M > N.
the 

interpolation method used is similar to zooming out a vectro graphics, I
use 

y(k) = x(floor(k*N/M))*(abs(k-ceil(k*N/M))) + x(ceil(k*N/M))*(abs(k-

floor(k*N/M))).
-----------------------------------------------------------------------------

Thank you again for reply.
Maybe I have not discribed clearly.

I agree with you all that zero-padding doesn't improve the resolution of a
spectrum.

But what puzzled me is that my interpolation method in the spectrum leads
to 
a distorted time data. I want to know why. Firstly, I discribe my
interpolation method as follows, similar to zooming out operation. Can you
depict what the time domain data like after this interpolation.
----------------------------------------------------------------------------
I interpolate the spectrum

from N points(x(n), 0<= n < N) to M (y(n), 0<= n < M) points and M > N.
the 

interpolation method used is similar to zooming out a vectro graphics, I
use 

y(k) = x(floor(k*N/M))*(abs(k-ceil(k*N/M))) + x(ceil(k*N/M))*(abs(k-

floor(k*N/M))).
-----------------------------------------------------------------------------

Thank you again for reply.
Maybe I have not discribed clearly.

I agree with you all that zero-padding doesn't improve the resolution of a
spectrum.

But what puzzled me is that my interpolation method in the spectrum leads
to 
a distorted time data. I want to know why. Firstly, I discribe my
interpolation method as follows, similar to zooming out operation. Can you
depict what the time domain data like after this interpolation.
----------------------------------------------------------------------------
I interpolate the spectrum

from N points(x(n), 0<= n < N) to M (y(n), 0<= n < M) points and M > N.
the 

interpolation method used is similar to zooming out a vectro graphics, I
use 

y(k) = x(floor(k*N/M))*(abs(k-ceil(k*N/M))) + x(ceil(k*N/M))*(abs(k-

floor(k*N/M))).
-----------------------------------------------------------------------------

Thank you again for reply.
On 1 Jul, 11:28, "coly" <wolon...@gmail.com> wrote:
> Maybe I have not discribed clearly. > > I agree with you all that zero-padding doesn't improve the resolution of a > spectrum. > > But what puzzled me is that my interpolation method in the spectrum leads > to > a distorted time data. I want to know why.
I don't understand what you mean? If you manipulate the spectrum and then transform this manipulated spectrum back to time domain, you would expect some changes compared to the original data. If you allow for this, then keep in mind that any interpolation routine is imperfect and introduces artifacts. Maybe that's what you see? Rune
Maybe I have not discribed clearly.

I agree with you all that zero-padding doesn't improve the resolution of a
spectrum.

But what puzzled me is that my interpolation method in the spectrum leads
to 
a distorted time data. I want to know why. Firstly, I discribe my
interpolation method as follows, similar to zooming out operation. Can you
depict what the time domain data like after this interpolation.
----------------------------------------------------------------------------
I interpolate the spectrum

from N points(x(n), 0<= n < N) to M (y(n), 0<= n < M) points and M > N.
the 

interpolation method used is similar to zooming out a vectro graphics, I
use 

y(k) = x(floor(k*N/M))*(abs(k-ceil(k*N/M))) + x(ceil(k*N/M))*(abs(k-

floor(k*N/M))).
-----------------------------------------------------------------------------

Thank you again for reply.
kevin wrote:

   ...

> You're starting with the incorrect premise that zero padding will make > up for a too short sampling interval. It won't.
That was succinct (as short as possible, but not shorter) and articulate. Do you write professionally? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;