TERCERA PRÁCTICA untels

7
TERCERA PRÁCTICA QUILLAS FLORES, JHONATAN Análisis Numérico Prof. Luis Roca Galindo 2013

description

análisis de datos

Transcript of TERCERA PRÁCTICA untels

TERCERA PRCTICA

TERCERA PRCTICA QUILLAS FLORES, JHONATAN Anlisis Numrico Prof. Luis Roca Galindo 20131a) Un paracaidista se lanza de un avin y se mide su velocidad vertical en los primeros 10 segundos, halle usted el espacio recorrido con los datos que se adjuntan. Use el mtodo de Simpson compuesto.Usando los valores determinados:t(s) y(m/s) 0 0 1 9.0 2 16.7 3 23.2 4 28.6 5 33.3 6 37.2 7 40.5 8 43.4 9 45.7 10 47.8

CDIGO ejercicio a)function z=regla_simpson(a, b, n) h=(b-a)/n; x=linspace(a,b,n+1); f=[0;9.03;16.7;23.2;28.6;33.3;37.2;40.5;43.4; 45.7;47.8]; A=ones(f); A(2:2:n)=4; A(3:2:n-1)=2; z = (h/3)*(sum(f.*A)); endfunction a=0;b=10;n=10;integral1=regla_simpson(a,b,n);

Ejecutando:

-->integral1integral1 = 302.17333

Espacio recorrido : e= 302.17333 mCDIGO ejercicio b)function z=fun_x(x) z=0.1.*k.*log(sqrt(1+x)); endfunction function z=regla_simpson2(a, b, n) h=(b-a)/n; x=linspace(a,b,n+1); f=fun_x(x); A=ones(f); A(2:2:n)=4; A(3:2:n-1)=2; z = (h/3)*(sum(f.*A)); endfunction k=38; a=0; b=5; n=22; integral2=regla_simpson2(a,b,n);Ejecutando:-->integral2 integral2 =10.926006 La integral toma el valor: 10.926006CDIGO ejercicio c)function z=f(x, y) z=(x.^(2.*y)).*sin(x.*(y.^2)); endfunction function z=intSimpson2d(fun2d,a,b,c,d,n, m) hx=(b-a)/n; hy=(d-c)/m; x=linspace(a,b,n+1)'; y=linspace(c,d,m+1)'; f = zeros(n+1,m+1) for i=1:n+1 for j=1:m+1 f(i,j)=fun2d(x(i),y(j)); end end Ax=ones(x); Ay=ones(y); for j=2:m/2 Ay(2*j-1) = 2; end for j=1:m/2 Ay(2*j) = 4; end for i=2:n/2 Ax(2*i-1) = 2; end

end for i=1:n/2 Ax(2*i) = 4; end s=0; for i=1:n+1 s = s + Ax(i)*f(i,:)*Ay; end z = (hx*hy*s)/9; endfunctiona=1; b=2; c=3;d=4; n=18m=24;Integral3=intSimpson2d(f,a,b,c,d,n,m); Ejecutando:-->integral3 integral3 = - 1.0229048