mate deber graficas

14
ESCUELA POLITÉCNICA NACIONAL INGENIERÍA MECÁNICA MATEMÁTICA AVANZADA CODIGOS DE PROGRAMACIÓN Y GRÁFICAS DE ECUACIONES CLÁSICAS Y PROBLEMAS DE FRONTERA Nombre: Jhonny Dávila Paralelo: GR2

Upload: jr-luisao

Post on 04-Jan-2016

249 views

Category:

Documents


1 download

DESCRIPTION

mate avanzada

TRANSCRIPT

Page 1: mate deber graficas

ESCUELA POLITÉCNICA NACIONAL

INGENIERÍA MECÁNICA

MATEMÁTICA AVANZADA

CODIGOS DE PROGRAMACIÓN Y GRÁFICAS DE ECUACIONES CLÁSICAS Y PROBLEMAS

DE FRONTERA

Nombre: Jhonny Dávila

Paralelo: GR2

Fecha de entrega: 13 de julio del 2015

Page 2: mate deber graficas

Ecuación de Calor1.- Encontrar la distribución de temperatura de la barra rígida en la figura si se conoce:

t1=0 T2=0

u ( x , t )=∑n=1

Bn sen (nπl

¿x )e−k ( nπ

l)

2

t

¿

Bn=2l∫

0

l

h ( x ) sen( nπl x)dx

Codigoclearclose allsyms n x t l=1;k=5;h=(-x^2)+2*xBn = (2/l)*(int(h*(sin((n*pi*x)/l)))); Arm = 20;for n=1:Arm f(n,:) = sum (exp (k*((-t)*pi^2*n^2))* sin(n*pi*x) *Bn) ;enddisp (sum(f))x = linspace(0, 0.1, 2);t = linspace(0, 0.1, 1);[x,t] = meshgrid(x,t);Ut= subs(sum(f),'x',x);disp (Ut);Usubt = (sum(Ut));subplot(2,2,4),ezplot(Usubt,[0,0.04,]);title ('x vs f(t)');Ux= subs(sum(f),'t',t);disp (Ux);Usubx = (sum(Ux));subplot(2,2,2),ezplot(Usubx,[0,1]);title ('t vs f(x)');U = simple(sum(f));subplot(2,2,[1 3]), ezsurf(U,[0 ,0.05,0.2,0.5]);title ('Diagrama U(x,t) ');hold on;

Page 3: mate deber graficas

2) Encuentre la distribución de temperatura de una barra de longitud L cuyos extremos están aislados. Se sabe que la barra tiene una distribución inicial de temperatura.

u ( x , t )=Ao+∑n=1

Ancos ( nπl

¿x)e−k( nπ

l)

2

t

¿

Ao=1l∫0

l

h ( x )dx

An=2l∫

0

l

h ( x )cos (n¿πx / l)dx ¿

clc

Page 4: mate deber graficas

clearclose allsyms n x t h= x^2+2*xl=1;A0 = (1/l)(int(h,x,0,l));An = ((sin(n*pi/2)/(n*pi))-(2/((n^2)*pi^2))+(2*(-1^n)/(n^2*pi^2)));K= 1;Bn = 0;long = 10;for n=1:long f(n,:) = (sum (((sin(n*pi/2)/(n*pi))-(2/((n^2)*pi^2))+(2*(-1^n)/(n^2*pi^2))) *exp(-2*t*pi^2*n^2)* cos(n*pi*x) ) ) ;enddisp (sum(f))x = linspace(0, 0.5, 1);t = linspace(0,0.1, 1);%[x,t] = meshgrid(x,t);Ut= subs(sum(f),'x',x);disp (Ut)Usubt = (sum(Ut));subplot(2,2,4),ezplot(Usubt,[0,0.1]);title ('X vs f(t)');Ux= subs(sum(f),'t',t);disp (Ux)Usubx = (sum(Ux));subplot(2,2,2),ezplot(Usubx,[0,2]);title ('t vs f(x)');U = simple(sum(f));subplot(2,2,[1 3]), ezsurf(U,[0 ,0.01,0.25,0.5]);title ('diagrama expansion');hold on;

Page 5: mate deber graficas

Ecuación de Onda3) Hallar la función u(x,t) si se conoce lo siguiente: se sabe que la cuerda indicada en la figura tiene vibraciones transversales y no parte del reposo.

u ( x , t )=∑n=1

[An cos( anπl

¿t)+Bnsen(anπ / l) t ]sen (nπ / l)x ¿]

An=2l∫

0

l

h ( x ) sen( nπxl

)dx

Bn= 2anπ

∫0

l

v ( x ) sen (n¿πx / l)dx ¿

CODIGOS

clcclearclose allsyms n x t k=1;a=1;h=x^2+2*xA0 = 0;An = ((4*sin(n*pi/2)-n*pi*cos(n*pi/2)+n*pi*(-1^n))/((pi^2)*n^2) );l=1;Bn = ((-2*(-1^n))/(n*pi));a=1;long = 10;for n=1:long f(n,:) = sum ((((4*sin(n*pi/2)-n*pi*cos(n*pi/2)+n*pi*(-1^n))/((pi^2)*n^2) )*cos(n*pi*t)+((-2*(-1^n))/(n*pi))*sin(n*pi*t))*sin(n*pi*x)) ;enddisp (sum(f))x = linspace(0, 0.1, 1);t = linspace(0, 1, 10);%[x,t] = meshgrid(x,t);Ut= subs(sum(f),'x',x);disp (Ut);Usubt = (sum(Ut));subplot(2,2,4),ezplot(Usubt,[0.04,0.45]);title ('x vs f(t)');Ux= subs(sum(f),'t',t);disp (Ux);Usubx = (sum(Ux));subplot(2,2,2),ezplot(Usubx,[0,1]);title ('t vs f(x)');U = simple(sum(f));subplot(2,2,[1 3]), ezsurf(U,[0 ,0.4,0.35,1]);title ('diagrama');hold on;

Page 6: mate deber graficas

4) Una cuerda estirada está andada en el eje x cuando x es x=0, y x= pi , se sabe que las vibraciones transversales tienen lugar en un medio que ejerce una resistencia proporcional a la velocidad instantánea. Bajo esta consideración la ecuación de onda al resolver toma la siguiente forma:

u ( x , t )=∑n=1

[An cos(qnt¿)+ Bqn

¿ sen(nx)]e−Bl ¿]

An= 2π∫

0

π

h ( x ) sen(nx )dx

qn=√B2−n2

clcclearclose allsyms n x t k=1;a=1;qn=(B^2-n^2)^1/2An = 2/pi((2*sin(n*pi/2)-n*pi*cos(n*pi/2)+n*pi*(-1^n))/((pi^2)*n^2) );l=1;B = ((-2*(-1^n))/(n*pi));

Page 7: mate deber graficas

a=1;long = 10;for n=1:long f(n,:) = sum ((((4*sin(n*pi/2)-n*pi*cos(n*pi/2)+n*pi*(-1^n))/((pi^2)*n^2) )*cos(n*pi*t)+((-2*(-1^n))/(n*pi))*sin(n*pi*t))*sin(n*pi*x)) ;enddisp (sum(f))x = linspace(0, 0.1, 1);t = linspace(0, 1, 10);%[x,t] = meshgrid(x,t);Ut= subs(sum(f),'x',x);disp (Ut);Usubt = (sum(Ut));subplot(2,2,4),ezplot(Usubt,[0.04,0.45]);title ('x vs f(t)');Ux= subs(sum(f),'t',t);disp (Ux);Usubx = (sum(Ux));subplot(2,2,2),ezplot(Usubx,[0,1]);title ('t vs f(x)');U = simple(sum(f));subplot(2,2,[1 3]), ezsurf(U,[0 ,0.4,0.35,1]);title ('diagrama');hold on;

Page 8: mate deber graficas

ESTABILIDAD5) Determinar la distribución de temperatura para una placa rectangular de dimensiones x=0 y x= a, estas se encuentran aisladas, mientras las orillas superiror en inferior y=b , y=0, se mantienen a temperatura f1(x) y 0 respectivamente

u ( x , y )=Aoy+∑n=1

¿¿

An= 2

asenh( nπba

)∫0

a

f ( x ) cos( nπxa

)dx

Ao= 1abf (x )dx

clcclearclose allsyms n x ya= 2;b=2;n=10hh= (4*x)+3;A0 = 1/(a*b)*int(hh,0,a) ;An = (2/(a*sinh((n*pi*b)/a)))*int(hh*cos(n*pi*x/a),0,a);B= 1;l=pi;Bn = 0;long = 10; for n=1:long f(n,:) = A0*y + sum(An*sinh(n*pi*y/a)*cos(n*pi*x/a)) ; end disp (f) x = linspace(0,0.1,5); y = linspace(0.8,1,5); for h=1:length(y)

Page 9: mate deber graficas

Fx = sum(subs(f, 'y', y(h)));subplot(2, 2, 4),plot(x, subs(Fx, 'x', x), 'Color', rand(1,3), 'Linewidth', 2); hold on; legend(num2str(y)); end hold on; grid on; box on xlabel('x'); title('En funcion de "x" para distintos "y"') for h=1:length(x) Fy = sum(subs(f, 'x', x(h))); subplot(2,2,2),plot(y, subs(Fy, 'y', y), 'Color', rand(1, 3), 'Linewidth', 2); hold on; legend(num2str(x)); end hold on; grid on; box on title('En funcion de "y" para distintos "x"') xlabel('y'); U = simple(sum(f)); subplot(2,2,[1 3]), ezsurf(U,[0,0.15,0,0.1]); title ('diagrama'); hold on;

Page 10: mate deber graficas

6) Determinar u(x,y) si se conoce que el borde superior de la placa esta a 200° , el borde inferior a 100°, y los bordes laterals se encuentran a 0°. En una placa de dimensiones de 1x1.

An=200nπ

[1−(−1 )n ]

Bn=200nπ

[1−(−1 )n ][ 2−cosh (nπ )senh (nπ ) ]

u ( x , y )=∑n=1

[An cosh (nπy )+Bn sen (nπy ) ] sen (nπy )

clcclearclose allsyms n x ya= 2;b=2;n=10hh= (4*x)+3;A0 = 1/(a*b)*int(hh,0,a) ;An = (2/(a*sinh((n*pi*b)/a)))*int(hh*cos(n*pi*x/a),0,a);B= 1;l=pi;Bn = 0;long = 10; for n=1:long

Page 11: mate deber graficas

f(n,:) = A0*y + sum(An*sinh(n*pi*y/a)*cos(n*pi*x/a)) ; end disp (f) x = linspace(0,0.1,5); y = linspace(0.8,1,5); for h=1:length(y) Fx = sum(subs(f, 'y', y(h)));subplot(2, 2, 4),plot(x, subs(Fx, 'x', x), 'Color', rand(1,3), 'Linewidth', 2); hold on; legend(num2str(y)); end hold on; grid on; box on xlabel('x'); title('En funcion de "x" para distintos "y"') for h=1:length(x) Fy = sum(subs(f, 'x', x(h))); subplot(2,2,2),plot(y, subs(Fy, 'y', y), 'Color', rand(1, 3), 'Linewidth', 2); hold on; legend(num2str(x)); end hold on; grid on; box on title('En funcion de "y" para distintos "x"') xlabel('y'); U = simple(sum(f)); subplot(2,2,[1 3]), ezsurf(U,[0,0.15,0,0.1]); title ('diagrama'); hold on;

Page 12: mate deber graficas