Fourier Series - Cal Poly Pomona

ECE 307
Fourier Series
Z. Aliyazicioglu
Electrical & Computer Engineering Dept.
Cal Poly Pomona
Fourier Series
Periodic signal is a function that repeats itself every T seconds.
x(t ) = x(t ± nT )
T: period of a function,
n: integer 1,2,3,…
x(t)
t
T
2T
3T
x(t)
x(t)
t
T
T
2T
t
2T
1
Fourier Series
Periodic signal can be represented as sum of sinusoidals if the
signal is square-integrable over an arbitrary interval ().
t1 +T
∫
x(t ) dt < ∞
t1
So, it can be expressed as
∞
∞
n =1
n =1
x(t ) = a0 + ∑ an cos(nω0t ) + ∑ bn sin(nω0t )
= c0 + ∑ cn cos(nω0t + θ n )
∞
n
n =−∞
2π
T0
of the periodic function in
[rad/s].
n =1
∑Xe
ω0 =
ω0 fundamental frequency
∞
=
where
nω0 , for n = 2,3,4,...
jnω0t
are harmonic frequencies
Fourier Series
The parameters are called Fourier series expansion or coefficients and
given by
1
T0
a0 =
an =
bn =
2
T0
2
T0
t1 +T0
∫
x(t )dt
t1
t1 +T0
∫
x (t ) cos( nω 0t )dt
t1
t1 +T0
∫
x (t ) sin(nω 0t )dt
t1
cn = an2 + bn2
Xn =
1
T0
t1 +T0
∫
t1
x (t )e − jnω0t dt
n = 1, 2,3,...
Where t1 is arbitrary. It
can be set t1 = 0 or
t1 = −T0 / 2
n = 1, 2,3,...
θ n = − tan
bn
an
c0 = a0
n = ∓1, ∓2, ∓3,...
2
Fourier Series
Using Euler’s rule, X n can be written as
Xn =
1
T0
t1 +T0
∫
x(t )cos(nω0t )dt − j
t1
1
T0
t1 +T0
∫
x(t )sin(nω0t )dt
t1
Xn =
1
1
an − j bn
2
2
X −n =
1
1
an + j bn
2
2
If x(t) is a real-valued periodic signal, we have
X −n
t1 +T0
1
=
T0
X −n = X
∫
x(t )e
t1
jnω0t
1
dt =
T0
t1+T0

− jnω t
 ∫ x(t )e 0 dt 
 t1

*
*
n
To obtain and
an = 2Re {X n }
bn = −2 Im {X n }
Xn =
1
cn e jθn , n = 1, 2,3
2
Fourier Series
Remember that
t1 +T0
∫
cos(nω0t ) dt = 0
for all n
t1
t1 +T0
∫
sin(nω0t ) dt = 0
for all n
t1
t1 +T0
∫
cos(nω0t ) sin(mω0t ) dt = 0
for all n and m
t1
t1 +T0
∫
cos(nω0t ) cos(mω0t ) dt = 0
for all n ≠ m
t1
t1 +T0
∫
sin(nω0t ) sin(mω0t ) dt = 0
for all n ≠ m
t1
=
T
for all n = m
2
=
T
for all n = m
2
3
Fourier Series
Find the Fourier series of the following periodic signal
Example:
v(t)
Vm
v (t ) =
a0 =
Vm
t
T
1
T0
t
T
t1 +T0
∫
x(t )dt =
t1
3T
T
1 Vm
1V
T 1
t dt =  m t 2  = Vm
T ∫0 T
T  2T  0 2
T
an =
2T
T
2 Vm
2V
t cos( nω 0t ) dt = 2m ∫ t cos( nω 0t ) dt
T ∫0 T
T 0
=
T
2Vm  1
t
cos( nω 0t ) +
sin( nω0t ) 
2  2 2
T  n ω0
nω 0
0
=
2Vm  1
2π
1 
cos( n
T ) − 2 2  = 0 for all n

T 2  n 2ω 02
T
n ω0 
Fourier Series
T
bn =
T
2 Vm
2V
t sin( nω 0t ) dt = 2m ∫ t sin( nω 0t ) dt
T ∫0 T
T 0
=
T
2Vm  1
t
sin(nω0t ) −
cos( nω 0t ) 

T 2  n 2ω 02
nω 0
0
=
2Vm 
T
2π 
V
cos( n
T )  = − m for n
0 −
T2 
nω 0
T
nπ

The Fourier Series
∞
v (t ) = a0 + ∑ bn sin(nω0t )
n =1
v (t ) =
v (t ) =
Vm ∞ Vm
−∑
sin(nω0t )
2 n =1 nπ
Vm Vm
V
V
−
sin(ω0t ) − m sin(2ω0t ) − m sin(3ω0t ) − ...
2
π
2π
3π
4
Fourier Series
Let’s assume that Vm=2V and T=1ms
ω0 =
2π
= 2π 1000 rad/s
T0
>> Vm=2;
>> T=0.001;
>> w0=2*pi/T;
>> t=0:0.00001:0.002;
>> v1=Vm/2-Vm/pi*sin(w0*t);
>> plot (t,v1)
>> hold on;
>> v2=Vm/2-Vm/pi*sin(w0*t)Vm/(2*pi)*sin(2*w0*t);
>> plot (t,v2)
>> v3=Vm/2-Vm/pi*sin(w0*t)Vm/(2*pi)*sin(2*w0*t)Vm/(3*pi)*sin(3*w0*t);
>> plot (t,v3)
>> v4=Vm/2-Vm/pi*sin(w0*t)Vm/(2*pi)*sin(2*w0*t)Vm/(3*pi)*sin(3*w0*t)Vm/(4*pi)*sin(4*w0*t);
>> plot (t,v4)
>> xlabel ('t[s]')
>> title('v(t)')
Fourier Series
bn = −
Vm
for n=1,2,3,...
nπ
cn = an2 + bn2 =
θ n = − tan
Xn =
Vm
for n=1,2,3,...
nπ
bn
= 90
an
∞
v (t ) = c0 + ∑ cn cos(nω0t + θ n )
n =1
1
1
1 Vm
an − j bn = j
2
2
2 nπ
Xn =
1
1 Vm j 90
cn e jθn =
e
2
2 nπ
X 0 = c0
5
Fourier Series
The Effect of symmetry on the Fourier Coefficients
Even-function symmetry
x (t ) = x ( −t )
Even-function is defined as
a0 =
1
T0
t1 +T0
∫
an =
x(t )dt
t1
4
T0
T0 / 2
∫
x (t ) cos( nω 0t )dt
bn = 0 for all n
0
x(t)
t
2T
T
Fourier Series
The Effect of symmetry on the Fourier Coefficients
Odd-function symmetry
Odd-function is defined as
a0 =
1
T0
t1 +T0
∫
t1
x(t )dt
bn =
4
T0
T0 / 2
∫
x (t ) = − x ( −t )
x (t )sin( nω 0t )dt
an = 0 for all n
0
x(t)
-T
T
t
6
Fourier Series
Example:
x(t)
A
t
-t1
-T0
t1
T0
Assume that ,A=1 ,T0 = 4 s and t1 = 1 s Determine Fourier
series coefficients of in exponential and trigonometric form.
Plot the discrete spectrum of x(t).
x (t ) = x ( −t )
a0 =
1
T0
t1 +T0
∫
x(t )dt
an =
t1
4
T0
T0 / 2
∫
x (t ) cos( nω 0t )dt
0
bn = 0 for all n
Fourier Series
 T0 / 4
 1
 ∫ 1 dt  = t
 −T0 / 4
 T0
1 T T  1
=  0 + 0 =
T0  4 4  2
Example:
an =
4
T0
1
a0 =
T0
T0 / 4
4  1
sin( nω 0t )

0  nω 0
∫ 1cos(nω t ) dt = T
0
0
T0 / 4
−T0 / 4


T0 / 4
0





 2
4  1 
2π T0
 nπ 
) − 0  =
sin 
= 
 sin( n

π
2
T0  n
T0 4
 2 

  nπ
 T0

2
2
2
2

an =  ,0, − ,0, ,0, −
,.... 
3π
5π
7π
π

x(t ) =
1 2
2
2
2
cos(3ω0t ) +
sin(5ω0t ) −
cos(7ω0t )...
+ cos(ω0t ) −
2 π
3π
5π
7π
7
Fourier Series
>> t=0:0.001:8;
>> T=4;
>> w0=2*pi/T;
>> v=1/2+2/pi*cos(w0*t)2/(3*pi)*cos(3*w0*t)+2/(5*pi
)*cos(5*w0*t)2/(7*pi)*cos(7*w0*t);
>> plot (t,v)
>> xlabel ('t[s]')
>> title('v(t)')
Fourier Series
Example :
1
Xn =
1
1
e − jnω0 − e jnω0 
1e − jnω0t dt =
− j 4nω0 
4 −∫1
=
1 1 jnω0
e
− e − jnω0 

2nω0 j 2
=
1
1 sin(nω0 )
sin(nω0 ) =
2nω0
2 nω0
1 sin(n 2π / 4) 1 sin(nπ / 2)
=
2 n2π / 4
2 nπ / 2
n
1
= sinc( )
2
2
=
where
sinc( x ) =
sin(π x )
πx
8
Fourier Series
Example.1: (cont)
x(t ) =
∞
∑Xe
n =−∞
n
jnω0t
=
∞
1
n
∑ 2 sinc( 2 )e
jnω0t
n =−∞
Since is real and even,
n
an = 2 X n = sinc( )
2
a0 =
bn = 2 X n sin(∠X n ) = 0
x (t ) =
Since
x(t ) =
1 ∞
n
+ ∑ sinc( ) cos( nω0t )
2 n =1
2
ω 0 = 2π / 4
1 ∞
n
nπ t
+ ∑ sinc( ) cos(
)
2 n =1
2
2
1
2
n
cn = sinc( )
2
θ n = 0, π
x(t) n=1,3, 5,…has odd numbers’
harmonics. The even numbers’
harmonics are zero. Xn is always real,
so that the phase is either zero or π .
The magnitude of discrete spectrum is
shown in next page.
Fourier Series
Example.1: (cont)
Xn signal as sinc function
>>
>>
>>
>>
>>
n=-10:1:10;
x=0.5*sinc(n/2);
stem (n,x)
title('The 1/2*sinc(n/2) signal');
xlabel('n');
9
Fourier Series
Example.1: (cont)
Fourier series approximation
of signal x(t) for .
n = 0,1,3,5, and 7
>> t=-5:0.1:5;
>> n=0;
>> x=0.5;
>> plot (t,x)
>> hold on
>> n=1;
>> an=(sinc(n/2)*cos(2*pi*t*n/4));
>> x=x+an;
>> plot (t,x)
>> n=3;
>> an=(sinc(n/2)*cos(2*pi*t*n/4));
>> x=x+an;
>> plot (t,x)
>> n=5;
>> an=(sinc(n/2)*cos(2*pi*t*n/4));
>> plot (t,x)
>> x=x+an;
>> plot (t,x)
>> n=7;
>> an=(sinc(n/2)*cos(2*pi*t*n/4));
>> x=x+an;
>> plot (t,x,'r')
>> title('Fourier Series approximation for
Different n values')
>>
Fourier Series
x(t)
Example. 2:
1
t
-T0
-T0/4
0
-T0/2
T0
-1
a0 =
Xn =
Xn =
1
T0
1
T0
1
T0
t1 +T0
∫
x(t )dt = 0
t1
t1 +T0
∫
x(t )e − jnω0t dt
n = ∓1, ∓2, ∓3,...
t1
T0
T0 / 2 − jnω t

0
+
e
dt
e − jnω0t dt 
 ∫
∫
 0

T0 / 20
10
Fourier Series
Example. 2: (cont)
Xn =
Xn =
1
T0
 1
e − jnω0t

ω
jn
−
0

T0 / 2
0
−
1
e − jnω0t
− jnω0
T0


T0 / 2


1 1
1
(e − jnω0T0 / 2 − e − jnω0 0 ) −
(e − jnω0T0 − e − jnω0T0 / 2 )

− jnω0
T0  − jnω0

Xn =
2π T0
2π
2π T0
− jn
− jn T0
− jn

1 1 
T 2
T
T 2
1 − e 0 + e 0 − e 0 
T0 j n 2π 

T0
Xn =
1
1 − e − jnπ + e − jn 2π − e − jnπ 
jn 2π 
Xn =
2
1 − e − jnπ 
jn2π 
Fourier Series
Example. 2: (cont)
Xn =
π
π
π
−j n  j n
−j n
2
e 2 e 2 − e 2 
jn 2π


2 − j π2 n  π 
Xn =
e
 sin 2 n  n = ±1, ±2, ±3,...
nπ


π 

sin n 
π
π
−j n 
−j n
n
2
2
2
Xn = e
e
sinc ( )
=
 nπ 
2


2


n
Xn
1
0-j 0.6366
2
0+j0
3
0-j0. 212
4
0+j0
5
0-j0. 127
6
0+j0
7
0-j 0. 0909
8
0+j0
9
0-j0. 0707
10
0+j0
11
0-j 0. 05787
>> n=1:11;
>> x=(2./(pi*n)).*(sin(pi/2*n)).*exp(-j*(pi*n/2));
11
Fourier Series
Example. 2: (cont)
Xn =
1
1
an − j bn
2
2
bn=(-2)*imag(x)
n
1
2
3
4
5
6
7
8
9
10
11
bn
1.27
3
0
0.4244
0
0.2546
0
0.1818
9
0
0.1414
7
0
0.1157
x(t ) = 1.273sinω0t + 0.4244 sin3ω0t + 0.2546 sin5ω0t + 0.1818sin7ω0t + ....
x(t ) =
4
1
1
1

sinω0t + sin3ω0t + sin5ω0t + sin7ω0t + ....

3
5
7
π

Fourier Series
Example. 2: (cont)
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
t=0:0.000001:0.002;
b1=1.273*sin(2*pi*1000*t);
plot (t,b1)
hold on
b3=0.4244*sin(2*3*pi*1000*t);
b=b1+b3;
plot (t,b,'r')
b5=0.2546*sin(2*5*pi*1000*t);
b=b1+b3+b5;
plot (t,b,'g')
b7=0.18189*sin(2*7*pi*1000*t);
b=b1+b3+b5+b7;
plot (t,b,'y')
b9=0.14147*sin(2*9*pi*1000*t);
plot (t,b,'m')
title ('sum (b_n sin(n \omega t)')
12
Fourier Series
Example. 2: (cont)
>>n=1:11;
>>
x=(2./(n)).*(sin(pi/2*n)).*exp(j
*(pi*n/2));
xn=abs(x);
theta=(180*angle(x))/pi;
subplot (2,1,1);
stem(n,xn)
xlabel('n\omega_0');
ylabel('X_n');
title('X_n(n\omega_0)');
subplot (2,1,2)
stem(n,theta)
xlabel('n\omega_0')
ylabel('\theta')
title('\theta (n\omega_0)');
Fourier Series
Problem.1
x(t)
A
t
-T0
0
t1
T0
Assume that ,A=1 ,T0 = 4 s and t1 = 1 s Determine Fourier
series coefficients of in exponential and trigonometric form.
Plot the discrete spectrum of x(t).
Compare with Example 1
13
Fourier Series
Problem:
Write the Fourier series for the following periodic signal and
plot the sum of first 10 harmonics
x(t)
1
t
-T0
-T0/4
0
-T0/4
T0
-1
x(t ) = 1.273cosω0t − 0.4244cos3ω0t + 0.2546cos5ω0t − 0.1818cos7ω0t + ....
14