【问题标题】:Matlab second order derivativeMatlab二阶导数
【发布时间】:2013-03-01 21:11:27
【问题描述】:

按照http://www.mit.edu/people/abbe/matlab/ode.html上的教程,准备了一个函数如下:

function dxy = diffxy(xy)
%
%split xy into variables in our equations
%
x = xy(1);
xdot = xy(2);
y = xy(3);
%
% define the derivatives of these variables from equations
%
xdot = xdot;
ydot = 3*x + 2*y + 5;
xdoubledot = 3 - ydot + 2*xdot;
%
%return the derivatives in dxy in the right order
%
dxy = [xdot; xdoubledot; ydot]
end

当我使用

调用它时
[T, XY] = ode45('diffxy',0,10,[0 1 0])

我收到一个错误

??? Error using ==> diffxy
Too many input arguments.

我也试过了

XY= ode45(@diffxy,[0 10],[0;1;0])

有人知道吗?

【问题讨论】:

    标签: function matlab derivative


    【解决方案1】:

    尚未阅读整个教程,但您不应该将函数定义为

    function dxy = diffxy(t, xy)
    

    t 是时间向量

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-30
      • 1970-01-01
      • 2014-02-13
      • 2018-09-30
      相关资源
      最近更新 更多