SCILAB ode:如何解决二阶ODE

时间:2019-05-06 23:39:30

标签: scilab

我来自MATLAB中的ode45,试图在scilab中学习ode。我遇到一个例外,我不确定该如何解决。

function der = f(t,x)
    wn3 = 2800 * %pi/30; //rad/s
    m = 868.1/32.174; //slugs
    k = m*wn3^2; //lbf/ft
    w = 4100 * %pi/30; //rad/s
    re_me = 4.09/32.174/12; //slug-ft
    F0 = w^2*re_me; //lbf

    der(1) = x(2);
    der(2) = -k*x(1) + F0*sin(w*t);
endfunction

x0 = [0; 0];
t = 0:0.1:5;
t0 = t(1);
x = ode(x0,t0,t,f);
plot(t,x(1,:));

我收到我不明白的错误消息:

lsoda--  at t (=r1), mxstep (=i1) steps   
needed before reaching tout
      where i1 is :        500                                                  
      where r1 is :   0.1027287737654D+01                                       
Excessive work done on this call (perhaps wrong jacobian type).
at line    35 of executed file C:\Users\ndomenico\Documents\Scilab\high_frequency_vibrator_amplitude_3d.sce

ode: lsoda exit with state -1.

谢谢!

1 个答案:

答案 0 :(得分:1)

您的颂歌特别坚硬(k = 2319733)。对我来说,给这么大的最后时间没有任何意义。与驱动频率相比,您花费的时间步长(0.1)也非常大。如果您替换行

t = 0:0.1:5

通过

t = linspace(0,0.1,1001)

即在[0,0.1]和1000个时间步中请求t的解的近似值,您将获得以下输出: enter image description here