0% found this document useful (0 votes)
24 views7 pages

Eduardo Pérez Dawn

This document contains MATLAB code for calculating and plotting Fourier series approximations of various periodic functions. The code uses a for loop to iterate through integer values of n and add terms to the Fourier series approximation ft at each step. For each part, the code initializes variables, runs the for loop to calculate ft, and plots the result.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views7 pages

Eduardo Pérez Dawn

This document contains MATLAB code for calculating and plotting Fourier series approximations of various periodic functions. The code uses a for loop to iterate through integer values of n and add terms to the Fourier series approximation ft at each step. For each part, the code initializes variables, runs the for loop to calculate ft, and plots the result.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Eduardo Prez Dawn

3.3
(a)
clc
clear all
t=[1:0.001:10];
ft=1;
for n=1:100

ft=ft+(3/(pi*n)).*sin((4*pi*n)/3).*cos((2.*pi.*t.*n)
/3)+(9/(2*pi*n)).*(sin((2.*pi.*t.*n)/3))-
((3)/(2*pi*n)).*sin((2.*pi.*t.*n));

end
plot(t,ft); grid on;

(b)

clc
clear all
t=[1:0.001:10];
ft=1;
for n=1:100

ft=ft+(2/(n*pi)).*sin((pi).*n.*t);

end
plot(t,ft); grid on;
Eduardo Prez Dawn

(c)

clc
close
clear all
t=[0:0.001:10];
ft=3/2;
for n=1:100

ft=ft-(4/(pi*(2*n-1))^2).*cos((pi/2).*(2*n-1).*t)-
(2/(pi*n)).*sin((pi/2).*n.*t);

end
plot(t,ft); grid on;
Eduardo Prez Dawn

(d)

clc
clear all
t=[1:0.001:10];
ft=0;
for n=1:100

ft=ft+(6/pi).*(((-1)^(n-
1))/n.*sin((n.*pi.*t)/3)+(1/(3*n).*sin(n.*pi.*t)));

end
plot(t,ft); grid on;

(e)

clc
close
clear all
t=[-2:0.001:10];
ft=1/2;
for n=1:100

ft=ft+(4/(pi*(2*n-1))^2).*cos((pi/2).*(2*n-1).*t);

end
plot(t,ft); grid on;
Eduardo Prez Dawn

(f)
clc
close
clear all
t=[-1:0.0125:5];
ft=2/3;
for n=1:1000
ft=ft+((-3/(2*pi^2*n^2))-
(3/(n^2*pi^2))).*cos((8/3)*n*t*pi)+((1/(2*pi^2*n^2))
).*cos((8)*n*t*pi);
end
plot(t,ft); grid on;
Eduardo Prez Dawn

(g)

clc
clear all
t=[0:0.001:10];
ft=1/2;
for n=1:100

ft=ft+(4/(pi^2*(2*n-1)^2)).*cos((2*n-1).*pi.*t)-
(2/(n*pi)).*sin(n*pi*t);

end
plot(t,ft); grid on;

3.16

(a)

clc
close
clear all
t=[-2:0.001:10];
ft=5/4;
for n=1:1000
ft=ft+3/pi*(1/(4*n-3))*cos((pi/2)*(4*n-3)*t)-
3/pi*(1/(4*n-1))*cos((pi/2)*(4*n-1)*t)+((-1)^(n-
1)/(pi*n))*sin((pi/2)*n*t)+ ((-
1)^n/(pi*2*n))*sin(pi*n*t);

end
plot(t,ft); grid on;
Eduardo Prez Dawn

(b)

clc
close
clear all
t=[-2:0.001:10];
ft=1;
for n=1:10000

ft=ft+((4/(n*pi)).*sin((4*pi*n)/5)+(5/(n^2*pi^2)).*(
cos((4*pi*n)/5)-cos((2*pi*n)/5))).*cos((2*pi*n*t)/5)

end
plot(t,ft); grid on;

(c)
Eduardo Prez Dawn

clc
close
clear all
t=[-2:0.001:10];
ft=5/4;
for n=1:100

ft=ft+(4/(n^2*pi^2))*(-
1)^n.*cos((n*pi*t)/2)+(1/(n^2*pi^2))*(-1)^(n-
1).*cos(pi*n*t);

end
plot(t,ft); grid on;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy