• Viernes 29 de Marzo de 2024, 00:12

Autor Tema:  Invocar a un vector de funciones  (Leído 1527 veces)

Raul B

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
Invocar a un vector de funciones
« en: Sábado 20 de Abril de 2013, 18:00 »
0
Hola a todos. Miren, tengo la siguiente función programada por mi profesor de la universidad:

function [u,t]=euls(u0, t0, T, n, funcs)
% [u,t]=euls(u0, t0, T, n)
% Euler method to solve the system of m ordinary differential equations
% with m unknowns u(1), u(2), ... u(m), and initial values
%
% u'=f(t,u)
% u(t0)=u0
%
% in the interval [t0, T], with a discretization of n subintervals.
%
%
% INPUT:
% u0: initial value of the solution at t0
% t0: initial t
% T:    final t
% n:    number of subintervals
% funcs: function handler specifiying f(t,u). The funtion must be especified
% with 2 arguments. First argument t. Second argument: a 1 x m vector u.
%
% OUTPUT:
% u:    vector of approximations to u in t(i)=t0+ih, i=0, ...,n
% t: points where the approximation is computed
% LOCAL:
% h:    subinterval length
% m:    number of equations




h=(T-t0)/n;
m=length(u0);
u=zeros(n+1, m); % preallocation of u
t=((0:n)*h + t0)'; % preallocation of t
u(1, :)=u0;

for i=1:n
% Implement the Euler method
u(i+1, :)=u(i,:)+h*funcs(t(i), u(i,:));
end



A continuación debo usarla para resolver un problema de valores iniciales en donde u0=1, t0=0, T=1. Pero en cuanto al sistema de ecuaciones es : u'=v; v'=5v+4u

Asi pues mi problema es que no se como invocarla. Ya hice problemas de estos cuando se trataba de una simple EDO, pero no para un sistema entonces no se como invocarla. Seria algo así?

[u,t]=euls(1, 0, 1, 100, .....)

Pero no se que poner en la ultima parte. Alguien me echa una mano? GRACIAS DE ANTEMANO!!!