must return a column vector

4 次查看(过去 30 天)
I was drawing a vector field using phaplane, but I cannot draw any specific solution curve
>> g = @(t,Y) [Y(2), -Y(1)]
>> phaseplane(g, [-10,10], [-10,10], 25)
>> hold on
>> drawphase(g, 50, 3, 4)
Error using odearguments (line 93)
@(T,Y)[Y(2),-Y(1)] must return a column vector.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in drawphase (line 20)
[ts,ys] = ode45(g,[0,tmax],[y1start;y2start]);

采纳的回答

Walter Roberson
Walter Roberson 2019-5-3
g = @(t,Y) [Y(2); -Y(1)];
Notice the ; instead of ,
  1 个评论
Taorui Wang
Taorui Wang 2019-5-3
Cannt believe i made such a silly mistake! Thank you for pointing that out and responding so quickly

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by