Sign in

Not a member? | Forgot your Password?

Search compdsp

Search tips


Free PDF Downloads

A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

Introduction to Sound Processing

C++ Tutorial

Discussion Groups

FIR Filter Design Software

Free Online Books

See Also

Embedded SystemsFPGA

Discussion Groups | Comp.DSP | Why two peaks in fft of sine wave

There are 3 messages in this thread.

You are currently looking at messages 1 to .


Is this discussion worth a thumbs up?

0

Why two peaks in fft of sine wave - Aarul Jain - 2003-07-12 13:15:00

Hi

I had made a fft c program and it is working perfectly for discrete
values. I have also checked it on MATLAB and quite sure that the
program is correct.

However I have two doubts.

I inputted the samples of a sine wave of 1000 Hz with a sampling
frequency 4000Hz. For a simple 16 point FFT I got two peaks one at
x[4] and other at x[12]. Now shouldn't a simple sine wave show just
one peak at 1000Hz.

Is it that the values I get are centered along the imaginary axis. I
am not able to understand where the frequency samples after doing fft
actually lie in the spectrum.

Please help me sorting this fundamental problem. I hope many of you
know the answer.

Thanks
Aarul Jain

_____________________________
 Free pdf download: Digital Signal Processing Maths.


Re: Why two peaks in fft of sine wave - Fred Marshall - 2003-07-12 14:54:00

"Aarul Jain" <a...@yahoo.com> wrote in message
news:2...@posting.google.com...
> Hi
>
> I had made a fft c program and it is working perfectly for discrete
> values. I have also checked it on MATLAB and quite sure that the
> program is correct.
>
> However I have two doubts.
>
> I inputted the samples of a sine wave of 1000 Hz with a sampling
> frequency 4000Hz. For a simple 16 point FFT I got two peaks one at
> x[4] and other at x[12]. Now shouldn't a simple sine wave show just
> one peak at 1000Hz.
>
> Is it that the values I get are centered along the imaginary axis. I
> am not able to understand where the frequency samples after doing fft
> actually lie in the spectrum.
>
> Please help me sorting this fundamental problem. I hope many of you
> know the answer.

Congratulations, it appears to be working properly!
The FFT generates coefficients for complex exponentials.
To get a sine, you need the sum of two complex exponentials - one at
positive frequency and one at negative frequency.
The FFT generates a single replica of a periodic spectrum.  So you can think
of the result as being plotted on a circular axis that repeats at
x[0]=x[16].
The positive frequency component shows up 4 above x[0] or x[4]
The negative frequency shows up 4 below x[16] or x[12].

Since the time function is real, the even part will transform to an even
real function in frequency and the odd part will transform to an odd
imaginary part in frequency.
So, if the input was really sin(k*t) then you should have an odd, imaginary
output.
If the value at x[4] is j0.5 then the value at x[12] would be -j0.5.  So,
you really only need to know the N/2 values from x[0] to x[7] to know the
whole thing.  But, most FFTs allow complex inputs and provide the full N
outputs.

Fred

_____________________________
 Free pdf download: Digital Signal Processor Fundamentals and System Design.


Re: Why two peaks in fft of sine wave - Aarul Jain - 2003-07-12 21:38:00

Thanks for your good help.

Regards

Aarul Jain

"Fred Marshall" <f...@remove_the_x.acm.org> wrote in
message news:<2IYPa.2572$J...@feed2.centurytel.net>...
> "Aarul Jain" <a...@yahoo.com> wrote in message
> news:2...@posting.google.com...
> > Hi
> >
> > I had made a fft c program and it is working perfectly for discrete
> > values. I have also checked it on MATLAB and quite sure that the
> > program is correct.
> >
> > However I have two doubts.
> >
> > I inputted the samples of a sine wave of 1000 Hz with a sampling
> > frequency 4000Hz. For a simple 16 point FFT I got two peaks one at
> > x[4] and other at x[12]. Now shouldn't a simple sine wave show just
> > one peak at 1000Hz.
> >
> > Is it that the values I get are centered along the imaginary axis. I
> > am not able to understand where the frequency samples after doing fft
> > actually lie in the spectrum.
> >
> > Please help me sorting this fundamental problem. I hope many of you
> > know the answer.
> 
> Congratulations, it appears to be working properly!
> The FFT generates coefficients for complex exponentials.
> To get a sine, you need the sum of two complex exponentials - one at
> positive frequency and one at negative frequency.
> The FFT generates a single replica of a periodic spectrum.  So you can
think
> of the result as being plotted on a circular axis that repeats at
> x[0]=x[16].
> The positive frequency component shows up 4 above x[0] or x[4]
> The negative frequency shows up 4 below x[16] or x[12].
> 
> Since the time function is real, the even part will transform to an even
> real function in frequency and the odd part will transform to an odd
> imaginary part in frequency.
> So, if the input was really sin(k*t) then you should have an odd,
imaginary
> output.
> If the value at x[4] is j0.5 then the value at x[12] would be -j0.5.  So,
> you really only need to know the N/2 values from x[0] to x[7] to know the
> whole thing.  But, most FFTs allow complex inputs and provide the full N
> outputs.
> 
> Fred

_____________________________
 Free pdf download: Digital Signal Processor Fundamentals and System Design.