DSPRelated.com
Forums

question on taking FFT of a negative-time signal?

Started by kiki November 27, 2004
Hi all,

I want to ask about taking FFT of a signal discrete-time whose indices are 
limited in [-6, +6] and with 13 data points.

x[n]=
1, for n=-2 .. +2;
0, for other n in [-6, +6]

However, in Matlab all indices start from 1, so I have to input this 
sequence as

x=[0 0 0 0 1 1 1 1 1 0 0 0 0];

y=fftshift(fft(x));

since the indeces have been shifted, so the y has no zero imaginary part(the 
original input sequence is real and even so y should have zero imaginary 
parts)

Now how to show the DFT of the original double-sided signal from -6 to 6? 
How to make y's imaginary parts zero?

-----------------------------------------

I have done the following experiments by using the shifting theorem: but I 
just could not make y's imaginary part zero... what's the probem?

>> y1=y.*exp(1j*2*pi*6*[0:length(y)-1]/13); >> imag(y1)
ans = Columns 1 through 6 -0.8230 0.2541 1.1974 0.6957 -1.4165 -3.8786 Columns 7 through 12 -4.9635 -3.8786 -1.4165 0.6957 1.1974 0.2541 Column 13 -0.8230
>> y1=y.*exp(-1j*2*pi*6*[0:length(y)-1]/13); >> imag(y1)
ans = Columns 1 through 6 -0.8230 0.2106 0.5606 -0.0000 0.6631 3.2154 Columns 7 through 12 4.9635 3.6531 0.9462 -0.1677 0.2887 0.1697 Column 13 -0.7752
>> y1=y.*exp(-1j*2*pi*6*[1:length(y)]/13); >> imag(y1)
ans = Columns 1 through 6 0.7752 -0.1697 -0.2887 0.1677 -0.9462 -3.6531 Columns 7 through 12 -4.9635 -3.2154 -0.6631 -0.0000 -0.5606 -0.2106 Column 13 0.8230
>> y1=y.*exp(1j*2*pi*6*[1:length(y)]/13); >> imag(y1)
ans = Columns 1 through 6 0.8230 -0.2541 -1.1974 -0.6957 1.4165 3.8786 Columns 7 through 12 4.9635 3.8786 1.4165 -0.6957 -1.1974 -0.2541 Column 13 0.8230
>>
"kiki" <lunaliu3@yahoo.com> wrote in message
news:co9dg5$hs3$1@news.Stanford.EDU...
> Hi all, > > I want to ask about taking FFT of a signal discrete-time whose indices are > limited in [-6, +6] and with 13 data points. > > x[n]= > 1, for n=-2 .. +2; > 0, for other n in [-6, +6] > > However, in Matlab all indices start from 1, so I have to input this > sequence as > > x=[0 0 0 0 1 1 1 1 1 0 0 0 0]; > > y=fftshift(fft(x)); > > since the indeces have been shifted, so the y has no zero imaginary
part(the
> original input sequence is real and even so y should have zero imaginary > parts) > > Now how to show the DFT of the original double-sided signal from -6 to 6? > How to make y's imaginary parts zero? > > ----------------------------------------- >
Hello Kiki, Look up the Heaviside shifting theorem for Fourier transforms and apply it to your fft's output. Clay
kiki wrote:
> Hi all, > > I want to ask about taking FFT of a signal discrete-time whose indices are > limited in [-6, +6] and with 13 data points. > > x[n]= > 1, for n=-2 .. +2; > 0, for other n in [-6, +6] > > However, in Matlab all indices start from 1, so I have to input this > sequence as > > x=[0 0 0 0 1 1 1 1 1 0 0 0 0]; > > y=fftshift(fft(x));
You are mistaken in your mapping. Matlab's x(1) corresponds to the time sequence's x_0, x(2) <-> x_1, etc. For negative indecies you have to take it mod(N), so x(13) corresponds to x_{-1}. Your vector should be x = [1 1 1 0 0 0 0 0 0 0 0 1 1];
> > since the indeces have been shifted, so the y has no zero imaginary part(the > original input sequence is real and even so y should have zero imaginary > parts) > > Now how to show the DFT of the original double-sided signal from -6 to 6? > How to make y's imaginary parts zero? > > ----------------------------------------- > > I have done the following experiments by using the shifting theorem: but I > just could not make y's imaginary part zero... what's the probem? >
You are shifting by the wrong amount. You shifted the original sample by 1/2 the overall cycle time, try this: fft(x) .* exp(0.5 * -1j*2*pi*[0:12]/13) If you don't have it already this question could be answered in much more depth by reading Oppenheim, Willsky & Young, "Signals and Systems" or other similar books. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com