Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

Complex Engineering Problem Signals and Systems EE-231L

COMPLEX ENGINEERING PROBLEM

Course: Signals & Systems Lab EE-231L

Session: Summer 2019

Semester & Section: EE-4A/B

Submitted by: Group 1

 M.Usama Sagri (EE 171026)


 Saadat Irfan (EE 171004)
 Hammad Hamid (EE 171001)
 Usman (EE 171088)

Submitted to: Engr. Nafees Ahmed

1
Complex Engineering Problem Signals and Systems EE-231L

No. Task CLO


1 To find and express a periodic, time-domain function mathematically
2 And then to find its equivalent Fourier Series representation.
3 Show that by increasing the frequency content of the signal, it resembles �(�) 1
4 Create a generic Matlab code which computes the Fourier Series of any function
(�) given as input along with time period and frequency.
Tasks

ABSTRACT:
Complex Engineering Problem of Signals and Systems Lab comprises of designing a Generic
Code whilst Utilizing Matlab.

The Code aims to design an equivalent Fourier series applicable to all Periodic Function’s f (t)
input in order to show function’s signal representation as a series of functions

INTRODUCTION:
Fourier series is infinite series expression of periodic signals in accord with trigonometric sine
and cosine function. Whereas A periodic Function is a function f(x) with period T >0 if the values
of the function repeat them regular intervals of independent variable x.

Fourier Series is helpful as if we expand functions in accord with trigonometric identities that
are of sine’s and cosines , so Fourier series is of use because it allows one to more easily analyze
and solve functions that are discontinuous or simply difficult to represent analytically.

FUNCTION:
F (t) = [ x 4 when−π ≤ x ≤ π
0,otherwise ]
If f (t) is a periodic function of period T, then under certain conditions, its Fourier series is given
by:

X (t) = a0 + ∑ an cos 2nt +b n sin 2 nt
n=1

Where

2
Complex Engineering Problem Signals and Systems EE-231L


1
a0 = ∫ f ( t ) dt
T0 T 0

In this function T 0=2 π ;


π
a0 =
1
∫ x 4 dx
2 π −π
a0 = [ ]
1 x5
2π 5

4
π
a0 = = 19.48
5


2
an = ∫ f (t ) cos n w 0 t dt
T0 T 0

2π 2π
Where w 0= = = 1;
T0 2π
π
2
an = ∫ x 4 cos (n x) dx
T 0 −π
π
1
an = ∫ x 4 cos (n x) dx
π −π

Problem:
π

∫ x 4 dx cos (n x)
−π

Now solving:
∫ x 4 cos(n x )dx
Integrate by parts: ∫udv = uv−∫v du
u= x 4 , dv = cos(nx)
sin ⁡( nx )
du= 4 x 3 dx , v =
n
4
x sin ⁡( nx ) 4 x 3 sin ⁡( nx )
∫ x 4 dx cos (n x)= -∫ dx
n n

Now solving:

3
Complex Engineering Problem Signals and Systems EE-231L

4 x 3 sin ⁡( nx )
∫ dx
n
Apply linearity:
4
= ∫ x 3 sin ⁡( nx ) dx
n

Now solving:
∫ x 3 sin ⁡( nx ) dx
Integrate by parts: ∫udv = uv−∫v du
u= x 3 , dv = sin(nx)
cos ⁡(nx)
du= 3 x2 dx , v = -
n
3
−x cos ⁡(nx) −3 x 2 cos ⁡( nx)
∫ x 3 sin(n x )dx= -∫ dx
n n

Now solving:
−3 x 2 cos ⁡( nx)
∫ dx
n
Apply linearity:
−3
= ∫ x 2 cos ⁡( nx ) dx
n

Now solving:
∫ x 2 cos ⁡( nx ) dx
Integrate by parts: ∫udv = uv−∫v du
u= x 2 , dv = cos(nx)
sin ⁡( nx )
du= 2 x 1 dx , v =
n
2
x sin ⁡(nx) 2 x sin ⁡( nx )
∫ x 2 cos (n x) dx= -∫ dx
n n

Now solving:
2 x sin ⁡( nx )
∫ dx
n
Apply linearity:
2
= ∫ x sin ⁡( nx ) dx
n

Now solving:
4
Complex Engineering Problem Signals and Systems EE-231L

∫ x sin ⁡( nx ) dx
Integrate by parts: ∫udv = uv−∫v du
u=x, dv = sin(nx)
−cos ⁡( nx )
du= dx , v =
n
−x cos ⁡( nx) −cos ⁡( nx )
∫ x sin (n x)dx= -∫ dx
n n

Now solving:
−cos ⁡( nx )
∫ dx
n
1
Substitute u=nx ⟶ dx = du
n
1
=− ∫cos(u)du
n2

Now solving:
∫cos(u)du
This is a standard integral:
=sin(u)

Plug in solved integrals:


1
− 2 ∫cos(u)du
n
−sin( u)
=
n2
Undo substitution u=nx:
−sin( nx)
=
n2

Plug in solved integrals:


−x cos ⁡(nx) −cos ⁡( nx )
-∫ dx
n n
sin(nx) −x cos ⁡(nx)
= 2
n n

5
Complex Engineering Problem Signals and Systems EE-231L

Plug in solved integrals:


2
∫ x sin ⁡( nx ) dx
n
2 sin(nx) −2 x cos ⁡( nx )
= 3
n n2

Plug in solved integrals:


x 2 sin ⁡( nx) 2 x sin ⁡( nx )
-∫ dx
n n
2
x sin ⁡( nx) 2 sin(nx) +2 x cos ⁡( nx)
= −
n n3 n2

Plug in solved integrals:


−3
∫ x 2 cos ⁡( nx ) dx
n
−3 x 2 sin ⁡( nx ) 6 sin(nx ) −6 x cos ⁡(nx)
= +
n 2
n4 n3

Plug in solved integrals:


3 2
−x cos ⁡( nx) −3 x cos ⁡( nx)
-∫ dx
n n
3 x 2 sin ⁡( nx ) 6 sin(nx ) x 3 cos ⁡( nx) 6 x cos ⁡( nx )
= − − +
n2 n4 n n3

Plug in solved integrals:


4
∫ x 3 sin ⁡( nx ) dx
n

12 x 2 sin ⁡( nx ) 24 sin(nx ) 4 x 3 cos ⁡( nx) 24 x cos ⁡( nx )


= − − +
n3 n5 n2 n4

Plug in solved integrals:


x 4 sin ⁡( nx ) 4 x 3 sin ⁡( nx )
-∫ dx
n n

x 4 sin ⁡( nx ) 12 x 2 sin ⁡( nx ) 24 sin(nx ) 4 x 3 cos ⁡( nx) 24 x cos ⁡( nx )


= − + + −
n n3
n5 n2 n4

6
Complex Engineering Problem Signals and Systems EE-231L

Plug in solved integrals:


1/π∫ x 4 sin ⁡( nx) dx
2 3
x 4 sin ⁡( nx ) 12 x sin ⁡( nx ) 24 sin(nx ) 4 x cos ⁡( nx) 24 x cos ⁡( nx )
= − + + −
πn πn 3
π n5 π n2 π n4

As we know that sin(π) = 0; Apply limit


π
8 πn ( π 2 n2−6 ) cos ( π n ) +2(π 4 n 4−12 π 2 n 2+24 )sin ⁡( nx )
∫ x 4 dx cos (n x) = n5
−π

By further solve the above equation we have;


π
8 ( π 2 n2−6 ) cos ( π n )
∫ x 4 dx cos (n x)= n
4
−π


2
bn = ∫ f ( t ) sin n w0 t dt
T0 T 0

2π 2π
Where w 0= = = 1;
T0 2π
π
2
bn = ∫ x 4 sin( n x ) dx
T 0 −π
π
1
bn = ∫ x 4 sin (n x) dx
π −π
As we know sin( π ¿ = 0
So; bn =0
Put all the values of a0 , an ∧bn in to Fourier expression

x(t)= a0 + ∑ an cos 2nt +b n sin 2 nt
n=1


8 ( π 2 n 2−6 ) cos ( π n )
x(t)= 19.48 + ∑ n4
cos 2nt +(0)sin 2 nt
n=1


8 ( π 2 n 2−6 ) cos ( π n )
x(t)= 19.48 + ∑ n
4
cos 2nt
n=1

General Matlab Code:

7
Complex Engineering Problem Signals and Systems EE-231L

close all
clear all
clc
syms x
pi=3.14;
sum=0;
y=exp(-x/2); %Desired Function
ao=(1/pi)*int(y,x,-pi,pi);
for n=1:90
%Finding the Co efficient
an=(1/pi)*int(y*cos(n*x),x,-pi,pi);
bn=(1/pi)*int(y*sin(n*x),x,-pi,pi);
sum=sum+(an*cos(n*x)+bn*sin(n*x));
grid on;
ezplot(x,(sum+ao/2),[-5*pi,5*pi]);
end

Plots for Different Values of n:

N=1

8
Complex Engineering Problem Signals and Systems EE-231L

N=2

N=5

9
Complex Engineering Problem Signals and Systems EE-231L

N=10

N=15

N=20

10
Complex Engineering Problem Signals and Systems EE-231L

N=35

N=50

CONCLUSION:
After observing the working principles and methods of how Fourier series operates when it
comes to decomposing a Periodic Signals into series of function ,the desired outcome has been
attained.

The Matlab code created was provided with different inputs for different plots and the
representation of Comparison in graphs of Fourier series was seen each time .Upon increment
in value of both the graphs was more synchronized.

11

You might also like