Solve a differential system in one file
2 次查看(过去 30 天)
显示 更早的评论
Hi i'm trying to solve this :
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);
end
[[T,Y]=ode15s(@vdp1000,[0 3000], [2 0]);
plot(T,Y(:,1),'-o')
but it does not work and i would like it work without command window but matlab answers me :
Error: File: vdp1000.m Line: 9 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "vdp1000".)
0 个评论
回答(1 个)
Torsten
2015-5-12
function driver
[T,Y]=ode15s(@vdp1000,[0 3000], [2 0]);
plot(T,Y(:,1),'-o')
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);
Best wishes
Torsten.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Enterprise Deployment with MATLAB Production Server 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!