Anda di halaman 1dari 8

Funcin Recta.

%funcion recta
%fundamental
clear all,clf,clc
t=0:1/100:1;
y=(1/2);
cn=1/pi;
y1=y-cn*sin(2*pi*t);
subplot (4,4,1)
plot(t,y1)
title('Aproximacion
Fundamental')
ylabel('f(t)')
grid
axis([0 2 0 1])
%seugnda aprox
y2=-cn*(1/2)*sin(4*pi*t)
subplot (4,4,2)
plot(t,y2)
title('2da aproximacion')
ylabel('f(t)')
grid
%suma de 2
a2=y1+y2;
subplot(4,4,3)
plot(t,a2)
title('Suma de 2 aprox')
ylabel('f(t)')
grid
axis([0 2 0 1])
%tercera aprox
y3=-cn*(1/3)*sin(6*pi*t)
subplot (4,4,6)
plot(t,y3)
title('3ra aproximacion')
ylabel('f(t)')
grid
%suma de 3
a3=y1+y2+y3
subplot (4,4,7)
plot(t,a3)
title('Suma de 3 aprox')
ylabel('f(t)')
grid
axis([0 2 0 1])
%cuarta aprox
y4=-cn*(1/4)*sin(8*pi*t)
subplot (4,4,10)
plot(t,y4)
title('4ta aproximacion')
ylabel('f(t)')
grid

VERA PARRA LUIS ENRIQUE

%suma de 4
a4=y1+y2+y3+y4
subplot (4,4,11)
plot(t,a4)
title('Suma de 4 aprox')
ylabel('f(t)')
grid
axis([0 2 0 1])
%quinta aprox
y5=-cn*(1/5)*sin(10*pi*t)
subplot (4,4,14)
plot(t,y5)
title('5ta aproximacion')
ylabel('f(t)')
grid
%suma de 5 aprox
a5=y1+y2+y3+y4+y5
subplot (4,4,15)
plot(t,a5)
title('Suma de 5 aprox')
ylabel('f(t)')
grid
axis([0 2 0 1])
%funcion original
y0=t;
subplot(4,4,16)
plot (t,y0)
title('Funcion original')
ylabel('f(t)')
grid

5CV5

VERA PARRA LUIS ENRIQUE

5CV5

%cuarta aprox
y4=a0*((2/(1+16*(pi^2)*16))*cos(1
6*pi*t)+
((4*8*pi)/(1+16*(pi^2)*16))*sin(1
6*pi*t));
subplot(4,4,10)
plot(t,y4)
title('cuarta aproximacion')
ylabel('f(t)')
grid

Funcin Exponencial.
%aproximacion fundamental.
clear all,clf,clc
t=0:0.001:0.5;
a0=0.79;
y=a0+a0*((2/(1+16*(pi^2)))*cos(4*
pi*t)+
((8*pi)/(1+16*(pi^2)))*sin(4*pi*t
));
subplot(4,4,1)
plot(t,y)
title('Aproximacion Fundamental')
ylabel('f(t)')
grid
axis ([0 .5 0 1])
%segunda aproximacion
y2=a0*((2/(1+16*(pi^2)*4))*cos(8*
pi*t)+
((2*8*pi)/(1+16*(pi^2)*4))*sin(8*
pi*t));
subplot(4,4,2)
plot(t,y2)
title('Segunda aproximacion')
ylabel('f(t)')
grid

%suma de 4 aprox
s4=s3+y4;
subplot(4,4,11)
plot(t,s4)
title('Suma de 4 aprox')
ylabel('f(t)')
grid
%quinta aprox
y5=a0*((2/(1+16*(pi^2)*25))*cos(2
0*pi*t)+
((5*8*pi)/(1+16*(pi^2)*25))*sin(2
0*pi*t));
subplot(4,4,14)
plot(t,y5)
title('Quinta aproximacion')
ylabel('f(t)')
grid

%suma de 2 aprox
s2=y+y2;
subplot(4,4,3)
plot(t,s2)
title('Suma de 2 aprox')
ylabel('f(t)')
grid

%suma de 5 aprox
s5=s4+y5;
subplot(4,4,15)
plot(t,s5)
title('Suma de 7 aprox')
ylabel('f(t)')
grid

%tercera aprox
y3=a0*((2/(1+16*(pi^2)*9))*cos(12
*pi*t)+
((3*8*pi)/(1+16*(pi^2)*9))*sin(12
*pi*t));
subplot(4,4,6)
plot(t,y3)
title('tercera aproximacion')
ylabel('f(t)')
grid

%funcion original
f=exp(-t);
subplot(4,4,16)
plot(t,f)
title('Funcion original')
ylabel('f(t)')
grid

%suma de 3 aprox
s3=s2+y3;
subplot(4,4,7)
plot(t,s3)
title('Suma de 3 aprox')
ylabel('f(t)')
grid

VERA PARRA LUIS ENRIQUE

5CV5

VERA PARRA LUIS ENRIQUE

5CV5

Serie de Fourier de una funcin recta con 77 aproximaciones.


%funcion recta.
clear all,clf,clc
n=77;
cn=1/pi;
t=0:0.001:1;
x=zeros(size(t));
y=1/2;
for n=1:1:n
x=y+x;
y=-cn*(1/n)*sin(2*pi*n*t);
plot(t,x)
grid
end
title('Aproximacin con 77 trminos')

VERA PARRA LUIS ENRIQUE

5CV5

Funcin Recta.
%graficas separadas
clear all,clf,clc
n=5;
cn=1/pi;
t=0:0.001:1;
x=zeros(size(t));
y=1/2;
hold on
for n=1:1:n
y=-cn*(1/n)*sin(2*pi*n*t);
x=y+x;
plot(t,x)
end
grid
hold off
title('Aproximacin con 5 trminos')

VERA PARRA LUIS ENRIQUE

5CV5

Serie de Fourier de una funcin exponencial (, ) con 77 terminos

clear all,clf,clc
t=0:0.001:0.5;
n=77;
a0=0.79;
y=a0;
x=zeros(size(t));
for n=1:1:n
x=y+x;
y=a0*((2/(1+16*(pi^2)*n*n))*cos(4*n*pi*t)+
((8*n*pi)/(1+16*(pi^2)*n*n))*sin(4*n*pi*t));
plot (t,x)
grid
end
title('Aproximacion con 77 terminos')

VERA PARRA LUIS ENRIQUE

5CV5

funcin exponencial
clear all,clf,clc
t=0:0.001:0.5;
n=5;
a0=0.79;
y=a0;
x=zeros(size(t));
hold on
for n=1:1:n
x=y+x;
y=a0*((2/(1+16*(pi^2)*n*n))*cos(4*n*pi*t)+(8*n*pi)/((1+16*(pi^2)*n*n))*si
n(4*n*pi*t));
plot (t,x)
grid
end
hold off
title('Aproximacion con 5 terminos')

VERA PARRA LUIS ENRIQUE

5CV5

Anda mungkin juga menyukai