Error Message Using ODE45
1 view (last 30 days)
Show older comments
The following code was copied directly from MatLab ODE45 documentation into MatLab script:
function dydt = vdp1(t,y)
%VDP1 Evaluate the van der Pol ODEs for mu = 1
% See also ODE113, ODE23, ODE45.
% Copyright 1984-2014 The MathWorks, Inc.
dydt = [y(2); (1-y(1)^2)*y(2)-y(1)];
[t,y] = ode45(@vdp1,[0 20],[2; 0]);
plot(t,y(:,1),'-o',t,y(:,2),'-o')
The error message received from RUN execution is:
>> vdp1
Not enough input arguments.
Error in vdp1 (line 7)
dydt = [y(2); (1-y(1)^2)*y(2)-y(1)];
Is there a solution or work around for this issue?
0 Comments
Answers (4)
Walter Roberson
on 14 Dec 2019
The part starting from
[t,y] = ode45(@vdp1,[0 20],[2; 0]);
plot(t,y(:,1),'-o',t,y(:,2),'-o')
Should be in a different file that is the one to be run.
0 Comments
See Also
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!