Van Der Pol. Error. Not enough input arguments.

1 vue (au cours des 30 derniers jours)
Maria Jose Legaz
Maria Jose Legaz le 6 Avr 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

Réponses (1)

Walter Roberson
Walter Roberson le 7 Avr 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.

Catégories

En savoir plus sur Model Architecture and Design dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by