Bias Expt6 Ecea106l 2q2223

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

School of Electrical Engineering, Electronics

Engineering, and Computer Engineering

Laboratory Experiment Report Rubric

NAME OF STUDENT: DATE SUBMITTED:

LEE MARVIN I. BIAS 01-06-23

EXPERIMENT TITLE EVALUATOR:

ENGR. ERNESTO M. VERGARA JR.


FOURIER SERIES

Poor Fair Good Very Good Excellent


Criteria Score
(1) (2) (3) (4) (5)
A. Completeness The laboratory report The laboratory report The laboratory report The laboratory report The laboratory report
and organization is untidy, did not follow is untidy, followed the is neat, followed the is neat, followed the is very neat, well
of the Experiment the given format, given format, some given format, some given format, no presented, followed
some parts are parts are missing, parts are missing, missing parts, and the given format,
Laboratory
missing, most most questions are not mostly questions are only a few questions organized, and the
Report questions are not answered. not answered. are not answered. required content is
answered. complete.
The result, gathered The result is correct, The result and The result and The result, gathered
data, and answers to however, gathered gathered data were gathered data were all data, and answers to
questions were all data, and answers to correct, however, correct, and most of questions are all
incorrect. If data questions were all answers to questions the answers to correct. If data sheets
B. Correctness of sheets are required in incorrect. If data were all incorrect. If questions are all are required in the
the gathered data the experiment, they sheets are required in data sheets are correct. If data sheets experiment, data
are not used. the experiment, data required in the are required in the sheets are fully
and answers to
sheets are used but experiment, data experiment, data consulted and correct
questions. wrong data are used sheets are consulted sheets are consulted data are used in the
in the computation or but some of the data but with few wrong tabulation or
tabulated. used are wrong. data used in the computation.
computation or
tabulation.

The interpretation of The interpretation of The interpretation of The interpretation of The interpretation of
data and discussion data and discussion data and discussion data and discussion data and discussion
C. Interpretation of were not based on the were based on the were based on the were based on the were based on the
data and result and data result and data result and data result and data result and data
discussion gathered during the gathered during the gathered during the gathered during the gathered during the
experiment. experiment, but does experiment, and experiment, and experiment and are
not present clarity. somehow presents mostly presents clarity. presented very clearly.
clarity.
The conclusion was The conclusion was The conclusion was The conclusion was The conclusion was
not based on the based on the based on the based on the based on the
D. Conclusion objectives and all objectives but not all objectives and few of objectives and most of objectives and all of
ideas are not coherent of the ideas are the ideas are coherent the ideas are coherent the ideas are coherent
or clear. coherent nor clear. but not too clear. and clear. and presented very
clearly.
The words used were The words used were The words used were The words used were The words used were
not appropriate, had somehow appropriate, appropriate, had good appropriate, had very appropriate, had
poor grammar, had had good grammar, grammar, had good good grammar, had excellent grammar,
E. Use of Language bad sentence had good sentence sentence construction very good sentence had excellent
construction and ideas construction and not and few of the ideas construction and sentence construction
were not clearly all ideas were clearly were clearly almost all of the ideas and all of the ideas
expressed. expressed. expressed. were clearly were clearly
expressed. expressed.
The laboratory report The laboratory report The laboratory report The laboratory report The laboratory report
F. Promptness was submitted two or was submitted one was submitted three to was submitted beyond was submitted on
more weeks late. week late. six days late the time assigned to time.
two days late.

AVERAGE: (A+B+C+D+E+F)/6
LEE MARVIN I. BIAS
Name:__________________________________ 01-06-23
Date:_____________________
ECEA106L/FOPI01
Course & Section:_________________________ ECE-O/2ND YEAR
Program & Year:____________

Experiment 6
Fourier Series

Objectives
By the end of the experiment, the student should be able to
 define the fourier series.
 analyze the periodic wave function characteristics using fourier series.
 demonstrate the usage of matlab in computing fourier series.
 construct a script file for solving fourier series.

Tools Required
 Personal Computer/Desktop Computer/Computer Workstation
 MATLAB software

Fourier Series
A Fourier series is an expansion of a periodic function in terms of an infinite sum of sines and cosines. Fourier
series make use of the orthogonality relationships of the sine and cosine functions. The computation and
study of Fourier series is known as harmonic analysis and is extremely useful as a way to break up
an arbitrary periodic function into a set of simple terms that can be plugged in, solved individually, and then
recombined to obtain the solution to the original problem or an approximation to it to whatever accuracy is
desired or practical.

The Fourier series of a periodic function f(x) is given by

where the Fourier coefficients ak, k = 1,2,3,....., and bk, k = 1,2,3,....., bounded at [-L,L], are given by
, , and

The nth partial sum of the Fourier series is

Example1.

; period =10

Solution
Matlab Command:

>> syms x
>> pw = piecewise(x>0 & x<5, 4, x>-5 & x<0, -4)

pw =

piecewise(x in Dom::Interval(0, 5), 4, x in Dom::Interval(-5, 0), -4)

>> a0 = int(pw,[-5,5])

a0 =

>> L=5

L=
5

>> n=1:10

n=

1 2 3 4 5 6 7 8 9 10

>> k = 1*n

k=

1 2 3 4 5 6 7 8 9 10

>> a = int(pw*cos(k*pi*x/L)/L,x,-L,L)

a=

[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

>> b = int(pw*sin(k*pi*x/L)/L,x,-L,L)

b=

[ 16/pi, 0, 16/(3*pi), 0, 16/(5*pi), 0, 16/(7*pi), 0, 16/(9*pi), 0]

>> fs = a0 + sum(a.*(cos(k*pi*x/L)) + b.*(sin(k*pi*x/L)))

fs =

(16*sin(pi*x))/(5*pi) + (16*sin((pi*x)/5))/pi + (16*sin((3*pi*x)/5))/(3*pi) + (16*sin((7*pi*x)/5))/(7*pi) +


(16*sin((9*pi*x)/5))/(9*pi)

Example 2.
Find the fourier series of

f(x) = |x|, [-1,1]; period = 2

Matlab Command

>> syms f x k L n
>> f=abs(x)

f=
abs(x)
>> n=1:10

n=

1 2 3 4 5 6 7 8 9 10

>> a0 = int(f/2*L,x,-L,L)

a0 =

1/2

>> k = 1*n

k=

1 2 3 4 5 6 7 8 9 10

>> a = int(f*cos(k*pi*x/L)/L,x,-L,L)

a=

[ -4/pi^2, 0, -4/(9*pi^2), 0, -4/(25*pi^2), 0, -4/(49*pi^2), 0, -4/(81*pi^2), 0]

>> b = int(f*sin(k*pi*x/L)/L,x,-L,L)

b=

[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

>> fs = a0 + sum(a.*(cos(k*pi*x/L)) + b.*(sin(k*pi*x/L)))

fs =

1/2 - (4*cos(3*pi*x))/(9*pi^2) - (4*cos(5*pi*x))/(25*pi^2) - (4*cos(7*pi*x))/(49*pi^2) -


(4*cos(9*pi*x))/(81*pi^2) - (4*cos(pi*x))/pi^2

> ezplot(fs,x)
>> ezplot(f,-1,1)
>> hold on
>> ezplot(fs,-1,1)
>> hold off
>> title('partial sum with n=2')
Part 1. Exercise:

Find the fourier series of the following periodic functions using manual computations and using matlab
command:

1. ; period = 10

2. ; period = 3600

3. ; period = 3600

4. ; period = 8
MANUAL COMPUTATION:
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
Note: Provide multiple copy of this answer sheet.
MATLAB COMMAND/ SYNTAX:
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
Note: Provide multiple copy of this answer sheet.
Part 2.

Create an m-file that will solve the fourier series of a given periodic waveform. Use the given functions in part
1 to test your created script file and compare the two results(part1 versus part 2).

MATLAB COMMAND/ SYNTAX:


__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
Part 1

1. Syntax:

syms x
pw=2*piecewise(x>-5&x<0,0,x>0&x<5,4)
T=10
L=T/2;
a0=(1/(2*L))*(int(pw,[-5,5]))
n=1:10;
k=1*n
a=int(pw*cos(k*pi*x/L)/L,x,-L,L)
b=int(pw*sin(k*pi*x/L)/L,x,-L,L)
fs=a0+sum(a.*(cos(k*pi*x/L))+ b.*(sin(k*pi*x/L)));
pretty(fs)

Answer:

2. Syntax:

syms x t
pw=piecewise(x>-pi&x<pi,2*x^2)
T=2*pi;
L=T/2;
a0=(1/(2*L))*(int(pw,[-pi,pi]))
n=1:10;
k=1*n;
a=int(pw*cos(k*pi*x/L)/L,x,-L,L)
b=int(pw*sin(k*pi*x/L)/L,x,-L,L)
fs=a0+sum(a.*(cos(k*pi*x/L))+ b.*(sin(k*pi*x/L)));
pretty(fs)
Answer:

3. Syntax:

syms x t
pw=2*piecewise(x>-pi&x<0,0,x>0&x<pi,sin(t))
T=2*pi;
L=T/2;
a0=(1/(2*L))*(int(pw,[-pi,pi]))
n=1:10;
k=1*n;
a=int(pw*cos(k*pi*x/L)/L,x,-L,L)
b=int(pw*sin(k*pi*x/L)/L,x,-L,L)
fs=a0+sum(a.*(cos(k*pi*x/L))+ b.*(sin(k*pi*x/L)));
pretty(fs)

Answer:

4. Syntax:

syms x
pw=3*piecewise(x>-4&x<0,-x,x>0&x<4,x)
T=8;
L=T/2;
a0=(1/(2*L))*(int(pw,[-4,4]))
n=1:10;
k=1*n;
a=int(pw*cos(k*pi*x/L)/L,x,-L,L)
b=int(pw*sin(k*pi*x/L)/L,x,-L,L)
fs=a0+sum(a.*(cos(k*pi*x/L))+ b.*(sin(k*pi*x/L)));
pretty(fs)

Answer:
Part 2

1. Syntax:

syms t n
f = 2*piecewise(t>-5&t<0,0,t>0&t<5,4);
T = 10;
L = T/2;
k = 1*n;
a0 = int(f/(2*L),t,-L,L);
an = int(f*cos(k*pi*t/L)/L,t,-L,L);
bn = int(f*sin(k*pi*t/L)/L,t,-L,L);
fs = a0 + sum(an.*(cos(k*pi*t/L))+ bn.*(sin(k*pi*t/L)));
pretty(fs)

Answer:

2. Syntax:

syms t n
f = piecewise(t>-pi&t<pi,2*t^2);
T = 2*pi;
L = T/2;
k = 1*n;
a0 = int(f/(2*L),t,-L,L);
an = int(f*cos(k*pi*t/L)/L,t,-L,L);
bn = int(f*sin(k*pi*t/L)/L,t,-L,L);
fs = a0 + sum(an.*(cos(k*pi*t/L))+ bn.*(sin(k*pi*t/L)));
pretty(fs)

Answer:
3. Syntax:

syms t n o
f =2*piecewise(t>-pi&t<0,0,t>0&t<pi,sin(o));
T = 2*pi;
L = T/2;
k = 1*n;
a0 = int(f/(2*L),t,-L,L);
an = int(f*cos(k*pi*t/L)/L,t,-L,L);
bn = int(f*sin(k*pi*t/L)/L,t,-L,L);
fs = a0 + sum(an.*(cos(k*pi*t/L))+ bn.*(sin(k*pi*t/L)));
pretty(fs)

Answer:

4. Syntax:

syms t n
f = 3*piecewise(t>-4&t<0,-t,t>0&t<4,t);
T = 8;
L = T/2
k = 1*n;
a0 = int(f/(2*L),t,-L,L);
an = int(f*cos(k*pi*t/L)/L,t,-L,L);
bn = int(f*sin(k*pi*t/L)/L,t,-L,L);
fs = a0 + sum(an.*(cos(k*pi*t/L))+ bn.*(sin(k*pi*t/L)))

Answer:
Interpretation

In this experiment, the student explores the concept and ideas about Fourier series through
manual computation together with MATLAB software. The experiment was divided into three parts. The
first one focuses on manually solving the given problems while the second and third part focuses on
utilizing MATLAB to solve the same problem. For the second part, the code pattern stays the same but
they differ on the given resulting to different answers. For the third part of the experiment, same idea
and pattern was done, only the format of the code was a bit different.

Conclusion

The main goal of this experiment is to define the Fourier series and analyze the periodic wave
function characteristics using Fourier series together with demonstrating the usage of MATLAB in
computing Fourier series. Upon completion, the student was able to meet all the goals and perform all
the needed parts in order to complete and fully understand the activities. Further observation shows that
utilizing MATLAB is much easier than manual computation given that the user is knowledgeable of the
process and MATLAB interface.

You might also like