Seguimos con los algoritmos.

dy/dx = y' = ln(y) + x^2

Creamos la funcin en un script.

Ver script: ecu.m

Para obtener la solucin en el intervalo 0..5 con x0=1:
[x,y] = ode23('ecu', [0,5], 1);
plot(x,y)


SISTEMAS DE ECUACIONES DIFERENCIALES

x1' = 1x1 + x2 + t
x2' = x1 - x2 + sen(t)

Valores iniciales:
x1(0) = 2
x2(0) = -1

Ver script: sis2x2.m

Para obtener la solucin en el intervalo 0..2:
[t,x] = ode23 ('sis2x2', [0,2], [2,-1]);
- El ltimo parmetro son las condiciones iniciales.
- Como salida, t es cada instante;
  x es el vector que representa x1,x2 en cada instante.

Para representar las funciones obtenidas.
plot(t, x(:,1))
plot(t, x(:,2))

Para representar todas las funciones en un grfico:
plot(t, x)


ECUACIONES DE ORDEN N

y''' - y'' + 2*y' + y = e^(-t)

Valores iniciales:
y(0) = 1
y'(0) = 2
y''(0) = -1

Lo convertimos en un sistema 3x3.

Sustituciones: x1=y; x2=y'; x3=y''

Derivamos para obtener:
x1' = x2
x2' = x3
x3' = -x1 -2*x2 + x3 + e^(-t)

A partir de los valores iniciales obtenemos:
x1(0) = 1
x2(0) = 2
x3(0) = -1

Ver script: sis3x3.m

Para obtener la solucin en el intervalo 0..3:
[t,x] = ode23 ('sis3x3', [0,3], [1,2,-1]);

Para representar cada funcin por separado:
plot(t, x(:,1))
plot(t, x(:,2))
plot(t, x(:,3))

Para representar todas las funciones en un grfico:
plot(t, x)
