Van Der Pol. Error. Not enough input arguments.
1 回表示 (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
Walter Roberson
2018 年 4 月 7 日
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!