ANIMACIÓN CUERDA VIBRANTE

2
ANIMACIÓN CUERDA VIBRANTE. MATLAB: %animación de la solución de la ecuacion de transporte %U_t+U_X=0 x=-10:0.1:10; t=0:0.05:10000; set(gca,'nextplot','replacechildren'); axis([-10 10 -2 2]); for i=1:length(t) u=(sin((pi*x)/2)*cos((pi*t(i))/2))+(1/2)*((sin((3*pi*x)/ 2))*cos((3*pi*t(i))/2))+(1/4)*((sin((5*pi*x)/2))*cos((5*pi*t(i))/2)); plot(x,u); M(i)=getframe; end GRAFICO: -10 -8 -6 -4 -2 0 2 4 6 8 10 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 PARA CUALQUIER EJERCICIO

description

matematicas avanzadas

Transcript of ANIMACIÓN CUERDA VIBRANTE

Page 1: ANIMACIÓN CUERDA VIBRANTE

ANIMACIÓN CUERDA VIBRANTE.

MATLAB:

%animación de la solución de la ecuacion de transporte %U_t+U_X=0x=-10:0.1:10; t=0:0.05:10000; set(gca,'nextplot','replacechildren');axis([-10 10 -2 2]); for i=1:length(t)u=(sin((pi*x)/2)*cos((pi*t(i))/2))+(1/2)*((sin((3*pi*x)/2))*cos((3*pi*t(i))/2))+(1/4)*((sin((5*pi*x)/2))*cos((5*pi*t(i))/2));plot(x,u);M(i)=getframe;end

GRAFICO:

-10 -8 -6 -4 -2 0 2 4 6 8 10-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

PARA CUALQUIER EJERCICIO

clcsyms x t m ; %Ingrese la funcion f(x)texto='***** MODELADO CUERDA *****: ';disp(texto);

Page 2: ANIMACIÓN CUERDA VIBRANTE

texto='FUNCION INGRESADA: ';disp(texto);F=input('INGRESE LA FUNCION= ')%F = sin(x)%Ingrese la dimension de la cuerdatexto='VALORES CARACTERISTICOS DE LA CUERDA: ';disp(texto);L=input('ingrese el valor de L= ')c=input('ingrese el valor de C= ')n=input('ingrese el valor de n= ') %Coeficiente para la serie de fouriertexto='COEFICIENTE DE LA SERIE DE FOURIER: ';disp(texto);Bn=(2/L)*int(F*sin(n*pi*x/L),x,0,L)pretty(Bn) %Constante arbitraria k=((c*n*pi)/L) %serie de fouriertexto='TERMINOS DE LA SERIE DE FOURIER : ';disp(texto); for x = 1:n u=Bn*cos(k*t)*sin(n*pi*x/L) end