Escolar Documentos
Profissional Documentos
Cultura Documentos
PROGRAMACION
function reglasimpson1_3tabla
x=input('ingrese x: ')
n=length(x);
k=(n-1)/2;
if (mod(n-1,2)==0)
h=x(2)-x(1);
y=input('ingrese y: ');
A=0;
j=1;
for i=1:k
S=(h/3)*(y(j)+4*y(j+1)+y(j+2));
A=A+S
j=j+2;
end
fprintf('el valor aproximado de la integral es: %f \nSe aplico %d
veces simpson 1/3',A,k );
else
fprintf('la cantidad de datos no permite aplicar el metodo');
end
end
SOLUCION
reglasimpson1_3tabla
ingrese x: [-18 -12 -6 0 6 12 18]
x=
-18 -12 -6 0 6 12 18
A=
27.2000
A=
83.2000
A=
154.8000
PROGRAMACION
function reglasimpson3_8tabla
x=input('ingrese x: ')
n=length(x);
k=(n-1)/3;
if (mod(n-1,3)==0)
h=x(2)-x(1);
y=input('ingrese y: ');
A=0;
j=1;
for i=1:k
A=A+(3*h/8)*(y(j)+3*y(j+1)+3*y(j+2)+y(j+3));
j=j+3;
end
fprintf('el valor aproximado de la integral es: %f \nSe aplico %d
veces simpson 3/8',A,k );
else
fprintf('la cantidad de datos no permite aplicar el metodo');
end
end
SOLUCION
>> reglasimpson3_8tabla
ingrese x: [-18 -12 -6 0 6 12 18]
x=
-18 -12 -6 0 6 12 18
𝑥 𝑥
−
𝑒 𝐶 +𝑒 𝐶
𝑓(𝑥) = 𝐶( − 1) para −2100 ≤ 𝑥 ≤ 2100 𝑝𝑖𝑒𝑠
2
Cuando C = 4491.
𝑏
Utilizando la ecuación 𝐿 = ∫𝑎 √1 + [𝑓´(𝑥)]2 𝑑𝑥, determine la longitud de los cables de
suspensión principal con los siguientes métodos de integración:
a. Método 1/3 de Simpson. Divida todo el intervalo en ocho subintervalos.
b. Método de Simpson 3/8. Divida todo el intervalo en nueve subintervalos.
5
4
𝑦𝑐 = ∫ 𝑦√9 − 𝑦 2 𝑑𝑦
25𝛑 −5
Calcule 𝑦𝑐 .
a. Utilice la función definida por el usuario Simpson 3/8.
10 5 2
∫ 𝑦 √9 − 𝑦 2 𝑑𝑦
𝐼𝑥 =
3 −5
a. Utilice la función definida por el usuario Simpson 3/8.
5. Considere la siguiente ODE de primer orden:
𝑑𝑦 𝑥 2
=
𝑑𝑥 𝑦
Para x=1 hasta x=2.1 con 𝑦0 = 2
function[x, y]=euler(ODE1,a,b,h,yINI)
x(1)=a;
y(1)=yINI;
N=(b - a)/h;
%y=ODE1(x,y);
for i=1:N
x(i+1)=x(i) + h;
y(i+1)=y(i) + ODE1(x(i),y(i))*h;
end
end
SOLUCION
[x, y]=euler(@ODE1,0,2.1,0.7,2)
dydx =
dydx =
0.2450
dydx =
0.9026
x=
y=
PROGRAMACION
function dydx=ODE1(x,y)
dydx=x^2/y
end
function[x, y]=eulermodificado(ODE1,a,b,h,yINI)
x(1)=a;
y(1)=yINI;
N=(b - a)/h;
%y=ODE1(x,y);
for i=1:N
x(i+1)=x(i) + h;
y(i+1)=y(i) +
(ODE1(x(i),y(i))+ODE1(x(i+1),y(i)+ODE1(x(i),y(i))))/2*h;
end
end
SOLUCION
[x, y]=eulermodificado(@ODE1,0,2.1,0.7,2)
dydx =
dydx =
dydx =
0.2450
dydx =
0.2349
dydx =
0.2349
dydx =
0.8446
dydx =
0.7956
dydx =
0.7956
dydx =
1.3531
x=
0 0.7000 1.4000 2.1000
y=
SOLUCION
cutta4
RESULTADOS FINALES
t y k1 k2 k3 k4
2𝑥 3
La solución analítica de la ODE es 𝑦 = √ + 4. Calcule en cada parte el error
3
entre la solución verdadera y la solución numérica en los puntos donde se determina
la solución numérica.
6. Considerar el siguiente sistema de dos ODEs:
𝑑𝑥 𝑑𝑦
= 𝑥 − 𝑦𝑡 =𝑡+𝑦 de t = 0 a t = 1.2 Con 𝑥0 = 1, Y
𝑑𝑡 𝑑𝑡
𝑦0 = 1