Azzera filtri
Azzera filtri

Van Der Pol. Error. Not enough input arguments.

2 visualizzazioni (ultimi 30 giorni)
Maria Jose Legaz
Maria Jose Legaz il 6 Apr 2018
Risposto: Walter Roberson il 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

Risposte (1)

Walter Roberson
Walter Roberson il 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.

Categorie

Scopri di più su Model Architecture and Design in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by