Professional Documents
Culture Documents
SCHOOL OF EE–ECE-CoE
INTRAMUROS, MURALLA, MANILA
Experiment No.6
Experiment Title:
Fourier Series
Answer:
(8*sin((7*pi*x)/5))/(7*pi) + (8*sin((9*pi*x)/5))/(9*pi)
2. Syntax:
>> syms f x m L n
>> f = 2*x.^2
>> n = 1: 5
>> L = pi
>> a0 = int(f/(2*L),x,-L,L)
>> m = 1*n
>> a = double(int(f*cos(m*pi*x/L)/L,x,-L,L))
>> b = int(f*sin(m*pi*x/L)/L,x,-L, L)
>> fs = a0 + sum (a.*(cos(m*pi*x/L))+b.*(sin(m*pi*x/L))
Answer:
3. Syntax:
>> syms x
>> pw=piecewise(x>-4 & x<0, -x, x>0 & x<4, x)
>> a0 = int(pw,[4,-4])
>> n = 1:8
>> 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)))
Answer:
- (4*cos(3*x))/(9*pi) - (4*cos(5*x))/(25*pi) -
(4*cos(7*x))/(49*pi) - (4*cos(x))/pi – 16)
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