# Even numbered harmonics and cosine waves?

#### AngryGecko

Joined Jul 7, 2017
44
Last edited:

#### AlbertHall

Joined Jun 4, 2014
12,187
The website insists that any repetitive waveform can be reduced to a series of sine waves. But I believe that any waveform, repeating or not, can be so represented.

#### AngryGecko

Joined Jul 7, 2017
44
The website insists that any repetitive waveform can be reduced to a series of sine waves. But I believe that any waveform, repeating or not, can be so represented.
But would the even harmonics be equivalent to cosine waves?

#### Papabravo

Joined Feb 24, 2006
19,580
But would the even harmonics be equivalent to cosine waves?
This is not a requirement. You can have even numbered harmonics that are sine waves or cosine waves depending on boundary and other conditions. The required value at the origin will affect this result.

#### AngryGecko

Joined Jul 7, 2017
44
For example when you calculate the fourier series of a wave, you have:

(dc component) +
a1*cos(t) + a2*cos(t*2)... +
b1*sin(t) + b2*sin(t*2)...

t is the fundamental frequency
a1 is the amplitude of the first cos wave
b1 is the amplitude of the first sin wave

Based on this, it seems like even numbered harmonics is not necessarily the same as cosine waves, also wouldn't a spectrum analyser need to have to diagrams, one for the sine waves and one for the cosine waves.

Last edited:

#### AngryGecko

Joined Jul 7, 2017
44
This is not a requirement. You can have even numbered harmonics that are sine waves or cosine waves depending on boundary and other conditions. The required value at the origin will affect this result.
So a spectrum analyser should have two diagrams, one for sine waves and one for cosine waves? Thanks for the reply!

#### crutschow

Joined Mar 14, 2008
31,124
Sine waves and cosine waves are both sinusoidal waves.
The only difference is the reference you use to determine the phase of the wave.
All by themselves, they are identical.

#### AngryGecko

Joined Jul 7, 2017
44
Sine waves and cosine waves are both sinusoidal waves.
The only difference is the reference you use to determine the phase of the wave.
All by themselves, they are identical.
So a spectrum analyser basically combines the sine waves and the cosine waves for every harmonic and shows the amplitude of those two combined without showing the phase shift?

#### crutschow

Joined Mar 14, 2008
31,124
So a spectrum analyser basically combines the sine waves and the cosine waves for every harmonic and shows the amplitude of those two combined without showing the phase shift?
Yes, a spectrum analyzer does not show phase shift.
It does show the amplitude of the signal and its harmonics at all the frequencies within its range without regard to phase shift.

#### MrChips

Joined Oct 2, 2009
27,685
There is no difference between a sine wave and a cosine wave except for phase difference.

sin(A + B) = sinA cosB + cosA sinB
Hence
sin(A + π/2) = sinA cos(π/2) + cosA sin(π/2)
sin(A + π/2) = cosA

A spectrum analyzer displays the power spectrum which is proportional to the square of the amplitude.

Hence, Asin(ωt) + Bcos(ωt) would be computed as A squared + B squared and displayed in the power spectrum. The phase shift is taken in account just as how you would compute the power of complex numbers, Re + j Imag.

#### AngryGecko

Joined Jul 7, 2017
44
Thanks for the help!

#### MrAl

Joined Jun 17, 2014
9,633
Hi,

The even harmonics are not the same as cosine waves. The even harmonics are just the waves that happen to have an even harmonic number and can be sine or cosine, and can even have any phase shift sometimes.

The fundamental is sin(w*t) or cos(w*t).
The harmonics are either sin(n*w*t) or cos(n*w*t).
Thus any even harmonic is either of those with n=2,4,6,8, etc.
An example even harmonic with a phase shift is:
sin(6*w*t+ph) or cos(6*w*t+ph).

Sometimes the analysis of a rectified wave starts with the amplitude at zero at t=0 and sometimes it starts at the max peak at t=0. This may make the difference between sin and cos used for the harmonics although we could check that.

To state this another way, a rectified sinusoidal wave can either be a rectified sine wave or a rectified cosine wave, or really a rectified wave with a different phase shift. So that means the incoming sinusoidal wave can have any phase relative to some other phase in the system./ We usually choose either sine or cosine though because there usually is no other phase reference in the system.

Also as you know there are the An and the Bn coefficients, but doing a rectified sine wave may eliminate the Bn leaving just the An which is a little more simple. Doing a rectified cosine wave may not produce that simplifiication (we'd have to try that but with some waves this works well).

Also, you can show the magnitude line spectrum and/or the phase line spectrum too.

As it turns out, the Bn are zero either way.

For the rectified sine:
An=-2*cos(pi*n)/(pi*n^2-pi)-2/(pi*n^2-pi)
Bn=0

and for the rectified cosine:
An=-4*cos((pi*n)/2)/(pi*n^2-pi)
Bn=0

and A0 is always 2/pi.

Last edited:

#### AngryGecko

Joined Jul 7, 2017
44
Hi,

The even harmonics are not the same as cosine waves. The even harmonics are just the waves that happen to have an even harmonic number and can be sine or cosine, and can even have any phase shift sometimes.

The fundamental is sin(w*t) or cos(w*t).
The harmonics are either sin(n*w*t) or cos(n*w*t).
Thus any even harmonic is either of those with n=2,4,6,8, etc.
An example even harmonic with a phase shift is:
sin(6*w*t+ph) or cos(6*w*t+ph).

Sometimes the analysis of a rectified wave starts with the amplitude at zero at t=0 and sometimes it starts at the max peak at t=0. This may make the difference between sin and cos used for the harmonics although we could check that.

To state this another way, a rectified sinusoidal wave can either be a rectified sine wave or a rectified cosine wave, or really a rectified wave with a different phase shift. So that means the incoming sinusoidal wave can have any phase relative to some other phase in the system./ We usually choose either sine or cosine though because there usually is no other phase reference in the system.

Also as you know there are the An and the Bn coefficients, but doing a rectified sine wave may eliminate the Bn leaving just the An which is a little more simple. Doing a rectified cosine wave may not produce that simplifiication (we'd have to try that but with some waves this works well).

Also, you can show the magnitude line spectrum and/or the phase line spectrum too.

As it turns out, the Bn are zero either way.

For the rectified sine:
An=-2*cos(pi*n)/(pi*n^2-pi)-2/(pi*n^2-pi)
Bn=0

and for the rectified cosine:
An=-4*cos((pi*n)/2)/(pi*n^2-pi)
Bn=0

and A0 is always 2/pi.
Thank you for the detailed explanation, what they meant on the page i posted a link to earlier was that the even numbered harmonics happened to be cosine waves in that very case (half wave rectified sinewave).

#### MrChips

Joined Oct 2, 2009
27,685
You are confusing the odd/evenness of a function and odd/even harmonics.

A function is even when f(x) = f(-x), i.e. it shows symmetry about x = 0 (mirror reflection about x = 0)
Cosine is an even function.

A function is odd when f(x) = -f(-x).
Sine is an odd function.

Odd and even harmonics refer to the frequency of the signal, not the phase.

If your fundamental frequency f = 1kHz, as in v = Asin(2πft)

2kHz, 4kHz, 6kHz, 8kHz,... would be even harmonics,
while,
3kHz, 5kHz, 7kHz, 9kHz,... would be odd harmonics.

#### AngryGecko

Joined Jul 7, 2017
44
You are confusing the odd/evenness of a function and odd/even harmonics.

A function is even when f(x) = f(-x), i.e. it shows symmetry about x = 0 (mirror reflection about x = 0)
Cosine is an even function.

A function is odd when f(x) = -f(-x).
Sine is an odd function.

Odd and even harmonics refer to the frequency of the signal, not the phase.

If your fundamental frequency f = 1kHz, as in v = Asin(2πft)

2kHz, 4kHz, 6kHz, 8kHz,... would be even harmonics,
while,
3kHz, 5kHz, 7kHz, 9kHz,... would be odd harmonics.
Yes, I was mixing those two up, thanks for the clearification!

#### MrChips

Joined Oct 2, 2009
27,685
Yes, I was mixing those two up, thanks for the clearification!
You're welcome.