Filter löschen
Filter löschen

Van Der Pol. Error. Not enough input arguments.

2 Ansichten (letzte 30 Tage)
Maria Jose Legaz
Maria Jose Legaz am 6 Apr. 2018
Beantwortet: Walter Roberson am 7 Apr. 2018
Hello.
I have just copy the program Van Der Pol resolution from mathworks.
This program:
function dy = vdp1000(t,y)
dy = zeros(2,1); % a column vector
dy(1) = y(2);
dy(2) = 1000*(1 - y(1)^2)*y(2) - y(1);
[T,Y] = ode15s(@vdp1000,[0 3000],[2 0]);
plot(T,Y(:,1),'-o')
when I run the program, appear the next error:
vdp1000
Error using vdp1000 (line 3)
Not enough input arguments.
The line 3 is: dy(1) = y(2);
what do I make wrong?
I would be very grateful to someone who helps me.
Best regards,
MJ

Antworten (1)

Walter Roberson
Walter Roberson am 7 Apr. 2018
You need to split that code into two parts.
[T,Y] = ode15s(@vdp1000,[0 3000],[2 0]);
plot(T,Y(:,1),'-o')
should be in one file, and
function dy = vdp1000(t,y)
dy = zeros(2,1); % a column vector
dy(1) = y(2);
dy(2) = 1000*(1 - y(1)^2)*y(2) - y(1);
should be in vdp1000.
You would invoke the other file, not the vdp1000 file.

Kategorien

Mehr zu Model Architecture and Design finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by