

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Prepara tus exámenes
Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Prepara tus exámenes con los documentos que comparten otros estudiantes como tú en Docsity
Encuentra los documentos específicos para los exámenes de tu universidad
Estudia con lecciones y exámenes resueltos basados en los programas académicos de las mejores universidades
Responde a preguntas de exámenes reales y pon a prueba tu preparación
Consigue puntos base para descargar
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Comunidad
Pide ayuda a la comunidad y resuelve tus dudas de estudio
Ebooks gratuitos
Descarga nuestras guías gratuitas sobre técnicas de estudio, métodos para controlar la ansiedad y consejos para la tesis preparadas por los tutores de Docsity
funciones de matemáticas como series de fourier
Tipo: Ejercicios
1 / 2
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!


function [U] = FourierClasico(f,N) % necesito el a0, an y bn a0=integral(f,-pi,pi)./(2.pi); for n=1:N f1=@(x) f(x).cos(n.x); f2=@(x) f(x).sin(n.x); a(n)=integral(f1,-pi,pi)./pi; b(n)=integral(f2,-pi,pi)./pi; end U=@(x) a0+0.x; u=[-pi:0.01:pi]; F=f(u); figure(); for n=1:N U=@(x) U(x)+a(n).cos(n.x)+b(n).sin(n.x); U1=U(u); plot(u,F,"b"),hold on, grid on, plot(u,U1,"r"); pause(3); hold off; end end
function [U,G] = FourirDesSimetrica(N,f,T) % primero hay que llevarlo a fourier normal, ahora depende de t y no de x x=@(t) (pi.t)./T; t=@(x) (x.T)./pi; f1=@(x) f(t(x)); a0=integral(f1,-pi,pi)./(2.pi); for n=1:N f2=@(x) f1(x).cos(n.x); f3=@(x) f1(x).sin(n.x); a(n)=integral(f2,-pi,pi)./pi; b(n)=integral(f3,-pi,pi)./pi; end G=@(x) a0+0.x; for n=1:N G=@(x) G(x)+a(n).cos(n.x)+b(n).sin(n.x); end U=@(t) G(x(t)); v=[-T:0.01:T]; U1=U(v); F1=f(v); figure(); plot(v,U1,"r"),hold on, grid on,plot(v,F1,"b"); end
function [U] = FouriDesAntiSimet(N,f,A,B) %funcion que depende de x pero esta dada estre A y B x=@(t) ((2.pi)./(B-A)).(t-((A+B)./2)); t=@(x) ((B-A)./(2.pi)).x+((B+A)./2); g=@(x) f(t(x)); a0=integral(g,-pi,pi)./(2.pi); for n=1:N g1=@(x) g(x).cos(n.x); g2=@(x) g(x).sin(n.x); a(n)=integral(g1,-pi,pi)./pi; b(n)=integral(g2,-pi,pi)./pi; end G=@(x) a0+0.x; for n=1:N G=@(x) G(x)+a(n).cos(n.x)+b(n).sin(n.x); end U=@(t) G(x(t)); v=[A:0.1:B]; U1=U(v); F=f(v); figure(); plot(v,F,"r"),hold on, grid on,plot(v,U1,"g"); end
function [S,Z] = MatrizFourier(f,N) %devolvera la suma S p=2.pi./(2.N+1); x=[-pi:p:pi-p]; A=zeros((2.N)+1); A(:,1)=[1./2]; for n=2: 2.N+ if rem(n,2)== A(:,n)=[(cos((n./2).x))']; else A(:,n)=[(sin((n-1)./2).x)']; end end F=(f(x))'; Z=inv(A).F; S=@(x) Z(1)./2+0.x; for n=2:(2N+1) if rem (n,2)== S=@(x) S(x)+Z(n).cos(n./2).x; else S=@(x) S(x)+Z(n).sin((n-1)./2.*x); end end end
function [U] = RepasoFouriSenos(f,N) %como ya se conoce que la funcion es impar los senos for n=1:N f1=@(x) f(x).sin(n.x); b(n)= 2.(integral(f1,0,pi))./pi; end U=@(x) 0.x; v=[-pi:0.01:pi]; F=f(v); figure(); for n=1:N U=@(x) U(x)+b(n).sin(n.x); U1=U(v); plot(v,U1,"y"), hold on, grid on,plot(v,F,"g"); pause(2); hold off; end end
function [U] = RepasoFuriCos(f,N) % como ya se que es par solo con cosenos, bn= a0=integral(f,0,pi)./pi; for n=1:N f1=@(x) f(x).cos(n.x); a(n)= integral(f1,0,pi).2./pi; end U=@(x) a0+0.x; v=[-pi:0.01:pi]; F=f(v); figure(); for n=1:N U=@(x) U(x)+a(n).cos(n.x); U1=U(v); plot(v,F,"y"),hold on, grid on,plot(v,U1,"g"); pause(1.5) hold off; end end
function [U] = RepasoOndaC1(L,N,f,g,a) %los extremos de x son 0 hay dos funciones conocidas for n=1:N f1=@(x) f(x).sin(n.pi.x./L); A(n)=2.(integral(f1,0,L))./L; g1=@(x) g(x).sin(n.pi.x./L); B(n)=(L./(n.pi.a)).2.integral(g1,0,L)./L; end U=@(x,t) 0.x+0.t; for n=1:N U=@(x,t) (U(x,t)+A(n).cos(n.pi.a.t./L)+B(n).sin(n.pi.a.t. /L)).sin(n.pi.x./L); end u=[0:0.01:L]; v=[0:3:100]; T=length(v); figure(); for m=1:T U1= U(u,v(m)); plot(u,U1,"g","Linewidth",3), hold on, grid on,axis([0 3 - 0.05 0.05]); pause(0.1); hold off; end end
function [U] = RepasoVibraciones2D(N,f,g,a,L,D,M) %primero hay que encontrar los coeficientes a y b for n=1:N for m=1:M f1=@(x,y) f(x,y).sin(n.pi.x./L).sin(m.pi.y./D); g1=@(x,y) g(x,y).sin(n.pi.x./L).sin(m.pi.y./D); A(n,m)=integral2(f1,0,L,0,D).4./(L.D); C=a.sqrt((m.pi./D).^2+(n.pi./L)^2); B(n,m)=integral2(g1,0,L,0,D)./C; end end U=@(x,y,t) 0.x+0.y+0.t; for n=1:N for m=1:M U=@(x,y,t) U(x,y,t)+((A(n,m).cos(C.t)+B(n,m).sin(C.t)).sin(n. pi.x./L).sin(m.pi.y./D)); end end %armando las particiones p=[0:0.01:L]; q=[0:0.01:D]; t=[0:1:100]; T=length(t); [P,Q]=meshgrid(p,q); figure(); for r=1:T U2= U(P,Q,t(r)); mesh(P,Q,U2),hold on, grid on,xlabel("EJE X"),ylabel("EJE Y"),axis([0 L 0 D]); pause(0.5); hold off end end
function [U] = RepasoEcuCalor1D(N,L,f,a) for n=1:N f1=@(x) f(x).sin(n.pi.x./L); A(n)=integral(f1,0,L).2./L; end U=@(x,t) 0.x+0.t; for n=1:N U=@(x,t) U(x,t)+A(n).exp(- (n.pi.a./L)^2.t).sin(n.pi.*x./L); end u=[0:0.01:L]; v=[0:1:50]; T=length(v); figure(); for t=1:T U1=U(u,v(t)); plot(u,U1,"g"), hold on, grid on; pause(1); hold off; end end
function [U] = EcuacionCalorNeuman(N,L,f,a) %OJO que esta funcion se desarrolla por cosenos a0=integral(f,0,L)./L; for n=1:N f1=@(x) f(x).cos(n.pi.x./L); B(n)=2./L.integral(f1,0,L); end U=@(x,t) a0+0.x+0.t; for n=1:N C=(n.pi.a./L)^2; U=@(x,t) U(x,t)+(B(n).exp(- C.t)).cos(n.pi.*x./L); end p=[0:0.01:L]; q=[0:1:100]; T=length(q); figure(); for r=1:T U1=U(p,q(r)); plot(p,U1,"g"),hold on, grid on; pause(1); hold off; end end
function [U] = EcuacionCalorDirchletNeumann(f,L,a,N) for n=1:N f1=@(x) f(x).sin((2.n-1).pi.x./(2.L)); B(n)= 2.integral(f1,0,L); end U=@(x,t) 0.x+0.t; for n=1:N U=@(x,t) U(x,t)+B(n).exp(-((a.(2.n- 1).pi./(2.L)).^2).t).sin((2.n-1).pi.x./(2.*L)); end v=[0:0.01:L]; t=[0:1:200]; M=length(t); figure(); for m=1:M U1=U(v,t(m)); plot(v,U1,'r','LineWidth',3),hold on, grid on; pause(0.3); hold off end
function [U] = ElipticaVersion1(L,D,f,N) for n=1:N f1=@(x) f(x).sin(n.pi.x./L); A(n)=2.integral(f1,0,L); A(n)=A(n)./sinh(pi.n.D./L); end U=@(x,y) 0.x+0.y; for n=1:N U=@(x,y) U(x,y)+A(n).sinh(pi.n.y./L).sin(pi.n.x./L); end x=[0:0.01:L]; y=[0:0.01:D]; [X,Y]=meshgrid(x,y); U1=U(X,Y); figure(); mesh(X,Y,U1),hold on, grid on; end
function [U] = ElipticaVersion2(L,D,f,g,N) for n=1:N f1=@(x) f(x).sin(n.pi.x./L); cf=2.integral(f1,0,L);
g1=@(x) g(x).sin(n.pi.x./L); cg=2.integral(g1,0,L); %para matriz M=[1 1;exp(pi.n.D./L) exp(-pi.n.D./L)]; % otro vector de terminos independientes W=[cg cf]; %en esta operacion no. por ser matrices Z=inv(M)W; A(n)=[Z(1)]; B(n)=[Z(2)]; end %ensamblando toda la expresion U=@(x,y) 0.x+0.y; for n=1:N U=@(x,y) U(x,y)+(A(n).exp(pi.n.y./L)+B(n).exp(- pi.n.y./L)).sin(n.pi.x./L); end x=[0:0.01:L]; y=[0:0.01:D]; [X,Y]=meshgrid(x,y); figure(); U1=U(X,Y); mesh(X,Y,U1),hold on,grid on;
end