# FFT harmonics question

Started by October 15, 2008
```Guys, I am making an FFT of a sin() wave from a signal generator (a few
tens of Hz)  with a sampling rate of 2500/sec. my FFT size is 8192 or
16384.
In either case I observe harmonics with multiples of the sine frequency
with decreasing amplitude. I assume that the discrete FFT will create such
artifacts, but how can I tell how much of these are real (my signal
generator in principle may also have some harmonics)?

Thanks
Peter
```
```"Peter123" <pr20@cornell.edu> writes:

> Guys, I am making an FFT of a sin() wave from a signal generator (a few
> tens of Hz)  with a sampling rate of 2500/sec. my FFT size is 8192 or
> 16384.
> In either case I observe harmonics with multiples of the sine frequency
> with decreasing amplitude. I assume that the discrete FFT will create such
> artifacts, but how can I tell how much of these are real (my signal
> generator in principle may also have some harmonics)?

Hi Peter,

The FFT won't produce "harmonics". Those must be from your signal
generator. What the FFT will do (potentially) is smear your nice
spectral lines, but it doesn't produce harmonics.
--
%% Fuquay-Varina, NC            %       'cause no one knows which side
%%% 919-577-9882                %                   the coin will fall."
%%%% <yates@ieee.org>           %  'Big Wheels', *Out of the Blue*, ELO
http://www.digitalsignallabs.com
```
```On 15 Okt., 14:40, Randy Yates <ya...@ieee.org> wrote:
> "Peter123" <p...@cornell.edu> writes:
> > Guys, I am making an FFT of a sin() wave from a signal generator (a few
> > tens of Hz) &#2013266080;with a sampling rate of 2500/sec. my FFT size is 8192 or
> > 16384.
> > In either case I observe harmonics with multiples of the sine frequency
> > with decreasing amplitude. I assume that the discrete FFT will create such
> > artifacts, but how can I tell how much of these are real (my signal
> > generator in principle may also have some harmonics)?
>
> Hi Peter,
>
> The FFT won't produce "harmonics". Those must be from your signal
> generator. What the FFT will do (potentially) is smear your nice
> spectral lines, but it doesn't produce harmonics.

Agreed. A typical problem is fixed-point signal generators that don't
dither.

Regards,
Andor
```
```In article <EIydnSUp6-UtQmjVnZ2dnUVZ_hadnZ2d@giganews.com>, "Peter123"
<pr20@cornell.edu> wrote:

> Guys, I am making an FFT of a sin() wave from a signal generator (a
fewtens of Hz)  with a sampling rate of 2500/sec. my FFT size is 8192
or16384.
> In either case I observe harmonics with multiples of the sine
frequencywith decreasing amplitude. I assume that the discrete FFT will
create suchartifacts, but how can I tell how much of these are real (my
signalgenerator in principle may also have some harmonics)?

Are you windowing the input before applying the FFT?
```
```On 15 Okt, 14:18, "Peter123" <p...@cornell.edu> wrote:
> Guys, I am making an FFT of a sin() wave from a signal generator (a few
> tens of Hz) &#2013266080;with a sampling rate of 2500/sec. my FFT size is 8192 or
> 16384.
> In either case I observe harmonics with multiples of the sine frequency
> with decreasing amplitude. I assume that the discrete FFT will create such
> artifacts, but how can I tell how much of these are real (my signal
> generator in principle may also have some harmonics)?

Unless you compute the FFT using a fixed-point number format
with the signal scaled to just a few bits of dynamic range,
the harmonics are caused by the signal generator. To check
this, make sure you use a floating-point number format when
you compute the FFT.

As for causes of the harmonics, there might be stability
issues with the signal generator or fixed-point quantization

Rune
```
```On Oct 15, 8:18&#2013266080;am, "Peter123" <p...@cornell.edu> wrote:
> Guys, I am making an FFT of a sin() wave from a signal generator (a few
> tens of Hz) &#2013266080;with a sampling rate of 2500/sec. my FFT size is 8192 or
> 16384.
> In either case I observe harmonics with multiples of the sine frequency
> with decreasing amplitude. I assume that the discrete FFT will create such
> artifacts, but how can I tell how much of these are real (my signal
> generator in principle may also have some harmonics)?
>
> &#2013266080;Thanks
> &#2013266080; &#2013266080; Peter

Is the fundamental frequency exactly where you expect it to be? Are
the higher harmonics really at (not sort of at) multiples of the
expected fundamanetal frequency?

Is there an integer number of periods of the waveform within the the
FFT duration?

Dirk
```
```>On Oct 15, 8:18=A0am, "Peter123" <p...@cornell.edu> wrote:
>> Guys, I am making an FFT of a sin() wave from a signal generator (a
few
>> tens of Hz) =A0with a sampling rate of 2500/sec. my FFT size is 8192
or
>> 16384.
>> In either case I observe harmonics with multiples of the sine
frequency
>> with decreasing amplitude. I assume that the discrete FFT will create
suc=
>h
>> artifacts, but how can I tell how much of these are real (my signal
>> generator in principle may also have some harmonics)?
>>
>> =A0Thanks
>> =A0 =A0 Peter
>
>Is the fundamental frequency exactly where you expect it to be? Are
>the higher harmonics really at (not sort of at) multiples of the
>expected fundamanetal frequency?
>
>Is there an integer number of periods of the waveform within the the
>FFT duration?
>
>Dirk
>

Thank you guys all the answers.
(1) I am doing FFT on double values.
(2)  BUT: I have checked the periodigram with an internally generated
generated sin() wave and there was no harmonics - as you all
predicted.
(3)  So it is indeed my lousy function generator. (a TENMA 72-6644)
Maybe it is because it can also generate other waveforms (square,
sawtooth, etc) and that could bleed in a bit... (???)

Peter

```
```Peter123 wrote:
> Guys, I am making an FFT of a sin() wave from a signal generator (a few
> tens of Hz)  with a sampling rate of 2500/sec. my FFT size is 8192 or
> 16384.
> In either case I observe harmonics with multiples of the sine frequency
> with decreasing amplitude. I assume that the discrete FFT will create such
> artifacts, but how can I tell how much of these are real (my signal
> generator in principle may also have some harmonics)?
>
>  Thanks
>     Peter

As stated, the FFT doesn't 'generate' harmonics when done properly.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html
```
```Peter123 wrote:

...

> (3)  So it is indeed my lousy function generator. (a TENMA 72-6644)
>      Maybe it is because it can also generate other waveforms (square,
>      sawtooth, etc) and that could bleed in a bit... (???)

Probably not crosstalk. More likely, an artifact of the sine generation
technique. Is there a purity (distortion) spec for the instrument?

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
** Posted from http://www.teranews.com **
```
```dbell wrote:

> On Oct 15, 8:18 am, "Peter123" <p...@cornell.edu> wrote:

>>Guys, I am making an FFT of a sin() wave from a signal generator (a few
>>tens of Hz)  with a sampling rate of 2500/sec. my FFT size is 8192 or
>>16384.

>>In either case I observe harmonics with multiples of the sine frequency
>>with decreasing amplitude. I assume that the discrete FFT will create such
>>artifacts, but how can I tell how much of these are real (my signal
>>generator in principle may also have some harmonics)?
(snip)

> Is there an integer number of periods of the waveform within the the
> FFT duration?

You didn't answer this one.  Unless you phase lock the sampling
frequency to the generator, or the other way around, it is very
unlikely that you have an integer number of periods in the FFT.

If not, you will see exactly what you say you get.

-- glen

```