Solving coupled ODE's by ode45 / exp input error

Hello,
I have a set of coupled differential equations that are in an .m file:
function dy = system_ex1(t, y)
dy = zeros (2 ,1);
dy(1) = -1.*exp^(-10./(y(2)+273)).*y(1);
dy(2) = 1000.*exp^(-10./(y(2)+273)).*y(1)-10.*(y(2)-20);
I solve it using ODE45 as such below:
Tspan = [0, 5];
IC = [1, 15];
[T, Y] = ode45(@system_ex1, Tspan, IC);
When I try to solve I am bombarded with messages. The first being "Error using exp" & "Not enough input arguments.". I believe that my ODE troubles stem from this but I also recieved many more ODE error messages as seen below:
Error using exp
Not enough input arguments.
Error in system_ex1 (line 7)
dy(1) = -1.*exp^(-10./(T+273)).*C;
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in Task1_Call (line 13)
[T, Y] = ode15s(@system_ex1, Tspan, IC);
Any and all help is appreciated, especially with trying to understand the issues with the exp function.
Thank you,
Mike

1 comentario

I switched some of the variables around before rerunning the function. The error messages are exactly the same with some variable name changes to match the above function. The error messages now read as:
Error using exp
Not enough input arguments.
Error in system_ex1 (line 6)
dy(1) = -1.*exp^(-10./(y(2)+273)).*y(1);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in Task1_Call (line 13)
[T, Y] = ode45(@system_ex1, Tspan, IC);
My apologies.
Mike

Iniciar sesión para comentar.

 Respuesta aceptada

madhan ravi
madhan ravi el 17 de Jul. de 2020

1 voto

exp(

1 comentario

Michael Baltayan
Michael Baltayan el 17 de Jul. de 2020
I am literally crying laughing at how dumb I am. Thank you so much, appreciate it.

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 17 de Jul. de 2020

Comentada:

el 17 de Jul. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by