ode45 in GUI
Show older comments
Hi I am new to GUI and I want to solve odes in the GUI. But now there are some errors.
function dhdt = toSolve(t,y)
dhdt(1) = 5;
dhdt(2) = 3;
dhdt = dhdt';
end
function Button_2Pushed(app, event)
[app.t, app.height_Tank1] = ode45(@toSolve,[0 20],[1; 3]);
plot(app.UIAxes3, app.t, app.height_Tank1(:,1));
app.UIAxes3.XLim = [0 20];
app.UIAxes3.YLim = [-3 3];
plot(app.UIAxes4, app.t, app.height_Tank1(:,2));
app.UIAxes4.XLim = [0 20];
app.UIAxes4.YLim = [-3 3];
end
I wanted the second function to make use of the first function, vdp to solve ode. I realize that vdp could not be handled(referenced? not sure about the wording). The error message is "Undefined function 'toSolve.vdp' for input arguments of type 'double'.
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);"
Could anyone help me with it? Thanks a lot!
1 Comment
Walter Roberson
on 16 Aug 2017
? I do not see any vdp in the code ?
Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!