ODE求解器产生运行时错误 - 没有足够的输入参数

时间:2017-10-15 06:16:40

标签: matlab

我无法弄清楚为什么ODE求解器不会运行。

使用

调用该函数
b = .01;
g = 9.806;
A = 2.5;
B = .25;
C = .13;

x_1 = y(2);

x_2 = f(t)/A - (b/A)*y(2)+B^2*cos(y(3))^2*f(t)/(A^2*C+A*B^2*cos(y(3))^2)...
    -B^2*b*y(2)*cos(y(3))^2/(A^2*C+A*B^2*cos(y(3))^2)...
    -B^2*g*sin(y(3))*cos(y(3))/(A*C+B^2*cos(y(3))^2)...
    +B^3*y(4)^2*sin(y(3))*cos(y(3))^2/(A^2*C+A*B^2*cos(y(3))^2)...
    +B/A*y(4)^2*sin(y(3));

x_3 = y(4);

x_4 = -B*f(t)*cos(y(3))/(A*C+B^2*cos(y(3))^2)...
    +B*b*y(2)*cos(y(3))/(A*C+B^2*cos(y(3))^2)...
    +A*B*g*sin(y(3))/(A*C+B^2*cos(y(3))^2)...
    -B^2*y(4)^2*sin(y(3))*cos(y(3))/(A*C+B^2*cos(y(3))^2);

dydt = [x_1;x_2;x_3;x_4];
end

function y = f(t)

if(t<2)
    y = 1;
else
    y = 0;
end
end

结果 “没有足够的输入参数.ODE1中的错误(第9行)” x_1 = y(2);

function dydt = ODE1(t,y)

from time import sleep print('Calculator v1.0 (Python 3.6.2)') ans = input('Hello! Are you here for calculating?(y/n)') if ans == 'y': print('OK! LOADING...') sleep(3) elif ans == 'n': print('Oh, you're not going ahead... OK.') quit() num1 = input('Input 1st number') method = input('Input symbol(+,-,*,/):') num2 = input('Input 2nd number') ans = num1+method+num2 print('Answer is ', ans)

0 个答案:

没有答案