MATLAB: Solving a differential equation

ddedifferential equationsmass matrixMATLABode

Hello,
I am working at a mathematical problem and I wanted to solve it numerically through MATLAB. The equation has the form:
y'(t) = g(t,y(t)) – a y(t)
and
g(t,y(t)) = b sinh[(g(t-dt, y(t-dt))] y(t) + c
with a,b,c in R.
I already tried using the ode and dde function in MATLAB without luck. Therefore I hope you can help me with the implementation in the code.

Best Answer

If your equations contain only linear combinations of the derivatives, you could formulate it as a mass matrix problem M(t,y)y' = f(t,y) . For the two equations you have provided in the comment,
dF = - R*dI/u_a;
dI = const2*cosh(insinh*F)*insinh*dF+vor*sinh(insinh*F)*dn*exp(-beta*dEC2);
you could set up the problem as follows:
y = [F; I];
M = [1 - R/u_a; const2*cosh(insinh*F)*insinh 1];
and f(t,y) would output
[0; vor*sinh(insinh*y(1))*dn*exp(-beta*dEC2)]
See the ode45 documentation for how to include a mass matrix.
(edited to include the relevant part of betlor5's comment)