0% found this document useful (0 votes)
42 views10 pages

Labo7 Serie de Fourier Trig

The document discusses trigonometric Fourier series. It provides code to calculate the Fourier series of 5 different functions or signals over different time intervals. For each function, it calculates the Fourier coefficients Ao, An, and Bn and plots the original function and its periodic extensions. The goal is to obtain the Fourier series representations and plots of the 5 given functions.

Uploaded by

Rogel Alfaro
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)
42 views10 pages

Labo7 Serie de Fourier Trig

The document discusses trigonometric Fourier series. It provides code to calculate the Fourier series of 5 different functions or signals over different time intervals. For each function, it calculates the Fourier coefficients Ao, An, and Bn and plots the original function and its periodic extensions. The goal is to obtain the Fourier series representations and plots of the 5 given functions.

Uploaded by

Rogel Alfaro
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/ 10

Universidad Nacional Mayor de San Marcos

Facultad de Ing. Electrónica y Eléctrica

LABORATORIO DE SEÑALES Y SISTEMAS


Docente: Luque Gamero Salomón

Tema: Serie de Fourier Trigonometrica Lab.7

Alumno: Alfaro Contreras, Rogel Helmholz

14190115

2019
SERIE TRIGONOMETRICA DE FOURIER

INTEGRACIÓN

1. Obtener la integral de las siguientes ecuaciones:

CODIGO
x1(t) = cos(2𝑡) 𝑠𝑒𝑛(𝑡) ; 0 < 𝑡 < 2

x2(t) = cos(𝑎𝑡) 𝑠𝑒𝑛(𝑏𝑡) ; 0 < 𝑡 < 1

𝑥3(𝑡) = 𝑡 5 (1 − 𝑡)8 ; 0 < 𝑡 < 1

𝑥4 = @(𝑡) 𝑡 . ^ 3 .∗ 𝑒𝑥𝑝 (−2 ∗ 𝑡 . ^ 2)


2. Obtener las series trigonométricas de Fourier de las figuras 1, 2, 3,4 y 5.
Obtener sus respectivas gráficas.

FIGURA 1

CODIGO:

syms t n
A=[-2 -1 1 ];
f=[ 0 1];
f=sym(f);
T=max(A)-min(A);
wo=2*pi/T;
Ao=0; hallando la serie de Fourier
for i=1:length(f)
Ao=Ao+int(f(i),'t',A(i),A(i+1));
end
Ao=simplify(Ao/(T));

An=0;
for i=1:length(f)
An=An+int(f(i)*cos(n*wo*t),A(i),A(i+1));
end
An=simplify(2*An/T);

Bn=0;
for i=1:length(f)
Bn=Bn+int(f(i)*sin(n*wo*t),A(i),A(i+1));
end
Bn=simplify(2*Bn/T);

An = char(An);
Bn = char(Bn);
An = simplify(sym(strrep(char(An),'sin(pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(pi*n)','0')));
An = simplify(sym(strrep(char(An),'cos(pi*n)','(-1)^n')));
Bn=simplify(sym(strrep(char(Bn),'cos(pi*n)','(-1)^n')));
An=simplify(sym(strrep(char(An),'sin(2*pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(2*pi*n)','0')));
An=simplify(sym(strrep(char(An),'cos(2*pi*n)','1')));
Bn=simplify(sym(strrep(char(Bn),'cos(2*pi*n)','1')));

disp('Ao')
disp('An')
disp('Bn')

x=linspace(min(A),max(A),1000);
fx=0;
for i=1:length(A)-1
if mod(i,2)==1
fx=fx+((x>=A(i))&(x<=A(i+1))).*subs(f(i),x);
else
fx=fx+((x>A(i))&(x<A(i+1))).*subs(f(i),x);
end
end
plot(x,fx,'Linewidth',2); hold on
plot(x+max(x)-min(x),fx,'Linewidth',2)
plot(x-max(x)+min(x),fx,'Linewidth',2)
plot([max(x) max(x)],[fx(1) fx(end)],'Linewidth',2)
plot([min(x) min(x)],[fx(end) fx(1)],'Linewidth',2)
grid on
xlabel('\bf TIEMPO');
ylabel('\bf AMPLITUD');
title('\bf GRÁFICA 1');

FIGURA 2

syms t n
A=[-2 -1 0 1 ];
f=[ 0 2*t+2 -2*t+2];
f=sym(f);
T=max(A)-min(A);
wo=2*pi/T;
Ao=0;
for i=1:length(f)
Ao=Ao+int(f(i),'t',A(i),A(i+1));
end
Ao=simplify(Ao/(T));

An=0;
for i=1:length(f)
An=An+int(f(i)*cos(n*wo*t),A(i),A(i+1));
end
An=simplify(2*An/T);

Bn=0;
for i=1:length(f)
Bn=Bn+int(f(i)*sin(n*wo*t),A(i),A(i+1));
end
Bn=simplify(2*Bn/T);

An = char(An);
Bn = char(Bn);
An = simplify(sym(strrep(char(An),'sin(pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(pi*n)','0')));
An = simplify(sym(strrep(char(An),'cos(pi*n)','(-1)^n')));
Bn=simplify(sym(strrep(char(Bn),'cos(pi*n)','(-1)^n')));
An=simplify(sym(strrep(char(An),'sin(2*pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(2*pi*n)','0')));
An=simplify(sym(strrep(char(An),'cos(2*pi*n)','1')));
Bn=simplify(sym(strrep(char(Bn),'cos(2*pi*n)','1')));

disp('Ao')
pretty(Ao)
disp('An')
pretty(An)
disp('Bn')
pretty(Bn)

x=linspace(min(A),max(A),1000);
fx=0;
for i=1:length(A)-1
if mod(i,2)==1
fx=fx+((x>=A(i))&(x<=A(i+1))).*subs(f(i),x);
else
fx=fx+((x>A(i))&(x<A(i+1))).*subs(f(i),x);
end
end
plot(x,fx,'Linewidth',2); hold on
plot(x+max(x)-min(x),fx,'Linewidth',2)
plot(x-max(x)+min(x),fx,'Linewidth',2)
plot([max(x) max(x)],[fx(1) fx(end)],'Linewidth',2)
plot([min(x) min(x)],[fx(end) fx(1)],'Linewidth',2)
grid on
xlabel('\bf TIEMPO');
ylabel('\bf AMPLITUD');
title('\bf GRÁFICA 1');
FIGURA 3:

syms t n
A=[-1.5 1.5 4.5];
f=[ cos(t) 0];
f=sym(f);
T=max(A)-min(A);
wo=2*pi/T;
Ao=0;
for i=1:length(f)
Ao=Ao+int(f(i),'t',A(i),A(i+1));
end
Ao=simplify(Ao/(T));

An=0;
for i=1:length(f)
An=An+int(f(i)*cos(n*wo*t),A(i),A(i+1));
end
An=simplify(2*An/T);

Bn=0;
for i=1:length(f)
Bn=Bn+int(f(i)*sin(n*wo*t),A(i),A(i+1));
end
Bn=simplify(2*Bn/T);

An = char(An);
Bn = char(Bn);
An = simplify(sym(strrep(char(An),'sin(pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(pi*n)','0')));
An = simplify(sym(strrep(char(An),'cos(pi*n)','(-1)^n')));
Bn=simplify(sym(strrep(char(Bn),'cos(pi*n)','(-1)^n')));
An=simplify(sym(strrep(char(An),'sin(2*pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(2*pi*n)','0')));
An=simplify(sym(strrep(char(An),'cos(2*pi*n)','1')));
Bn=simplify(sym(strrep(char(Bn),'cos(2*pi*n)','1')));

disp('Ao')
pretty(Ao)
disp('An')
pretty(An)
disp('Bn')
pretty(Bn)

x=linspace(min(A),max(A),1000);
fx=0;
for i=1:length(A)-1
if mod(i,2)==1
fx=fx+((x>=A(i))&(x<=A(i+1))).*subs(f(i),x);
else
fx=fx+((x>A(i))&(x<A(i+1))).*subs(f(i),x);
end
end
plot(x,fx,'Linewidth',2); hold on
plot(x+max(x)-min(x),fx,'Linewidth',2)
plot(x-max(x)+min(x),fx,'Linewidth',2)
plot([max(x) max(x)],[fx(1) fx(end)],'Linewidth',2)
plot([min(x) min(x)],[fx(end) fx(1)],'Linewidth',2)
grid on
xlabel('\bf TIEMPO');
ylabel('\bf AMPLITUD');
title('\bf GRÁFICA 1');

FIGURA 4:

syms t n
A=[-1 0 1];
f=[ exp(3*t) exp(-3*t)];
f=sym(f);
T=max(A)-min(A);
wo=2*pi/T;
Ao=0;
for i=1:length(f)
Ao=Ao+int(f(i),'t',A(i),A(i+1));
end
Ao=simplify(Ao/(T));

An=0;
for i=1:length(f)
An=An+int(f(i)*cos(n*wo*t),A(i),A(i+1));
end
An=simplify(2*An/T);

Bn=0;
for i=1:length(f)
Bn=Bn+int(f(i)*sin(n*wo*t),A(i),A(i+1));
end
Bn=simplify(2*Bn/T);

An = char(An);
Bn = char(Bn);
An = simplify(sym(strrep(char(An),'sin(pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(pi*n)','0')));
An = simplify(sym(strrep(char(An),'cos(pi*n)','(-1)^n')));
Bn=simplify(sym(strrep(char(Bn),'cos(pi*n)','(-1)^n')));
An=simplify(sym(strrep(char(An),'sin(2*pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(2*pi*n)','0')));
An=simplify(sym(strrep(char(An),'cos(2*pi*n)','1')));
Bn=simplify(sym(strrep(char(Bn),'cos(2*pi*n)','1')));

disp('Ao')
pretty(Ao)
disp('An')
pretty(An)
disp('Bn')
pretty(Bn)

x=linspace(min(A),max(A),1000);
fx=0;
for i=1:length(A)-1
if mod(i,2)==1
fx=fx+((x>=A(i))&(x<=A(i+1))).*subs(f(i),x);
else
fx=fx+((x>A(i))&(x<A(i+1))).*subs(f(i),x);
end
end
plot(x,fx,'Linewidth',2); hold on
plot(x+max(x)-min(x),fx,'Linewidth',2)
plot(x-max(x)+min(x),fx,'Linewidth',2)
plot([max(x) max(x)],[fx(1) fx(end)],'Linewidth',2)
plot([min(x) min(x)],[fx(end) fx(1)],'Linewidth',2)
grid on
xlabel('\bf TIEMPO');
ylabel('\bf AMPLITUD');
title('\bf GRÁFICA 1');
FIGURA 5:

syms t n
A=[-2 0 1 ];
f=[ t+2 -2*t+2];
f=sym(f);
T=max(A)-min(A);
wo=2*pi/T;
Ao=0;
for i=1:length(f)
Ao=Ao+int(f(i),'t',A(i),A(i+1));
end
Ao=simplify(Ao/(T));

An=0;
for i=1:length(f)
An=An+int(f(i)*cos(n*wo*t),A(i),A(i+1));
end
An=simplify(2*An/T);

Bn=0;
for i=1:length(f)
Bn=Bn+int(f(i)*sin(n*wo*t),A(i),A(i+1));
end
Bn=simplify(2*Bn/T);

An = char(An);
Bn = char(Bn);
An = simplify(sym(strrep(char(An),'sin(pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(pi*n)','0')));
An = simplify(sym(strrep(char(An),'cos(pi*n)','(-1)^n')));
Bn=simplify(sym(strrep(char(Bn),'cos(pi*n)','(-1)^n')));
An=simplify(sym(strrep(char(An),'sin(2*pi*n)','0')));
Bn=simplify(sym(strrep(char(Bn),'sin(2*pi*n)','0')));
An=simplify(sym(strrep(char(An),'cos(2*pi*n)','1')));
Bn=simplify(sym(strrep(char(Bn),'cos(2*pi*n)','1')));

disp('Ao')
pretty(Ao)
disp('An')
pretty(An)
disp('Bn')
pretty(Bn)

x=linspace(min(A),max(A),1000);
fx=0;
for i=1:length(A)-1
if mod(i,2)==1
fx=fx+((x>=A(i))&(x<=A(i+1))).*subs(f(i),x);
else
fx=fx+((x>A(i))&(x<A(i+1))).*subs(f(i),x);
end
end
plot(x,fx,'Linewidth',2); hold on
plot(x+max(x)-min(x),fx,'Linewidth',2)
plot(x-max(x)+min(x),fx,'Linewidth',2)
plot([max(x) max(x)],[fx(1) fx(end)],'Linewidth',2)
plot([min(x) min(x)],[fx(end) fx(1)],'Linewidth',2)
grid on
xlabel('\bf TIEMPO');
ylabel('\bf AMPLITUD');
title('\bf GRÁFICA 1');

You might also like