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 个评论

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

请先登录,再进行评论。

 采纳的回答

exp(

1 个评论

I am literally crying laughing at how dumb I am. Thank you so much, appreciate it.

请先登录,再进行评论。

更多回答(0 个)

类别

Community Treasure Hunt

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

Start Hunting!

Translated by