matlab老是显示input argument '' is undefined我没法在matlab上面运行我写的这东西,因为总是显示Input argument "currentValues" is undefined.Error in ==> pendulumODE at 10theta = currentValues(1);function derivs = pendulumODE(t,curr

来源:学生作业帮助网 编辑:作业帮 时间:2024/10/06 16:04:23
matlab老是显示input argument '' is undefined我没法在matlab上面运行我写的这东西,因为总是显示Input argument pendulumODE at 10theta = currentValues(1);function derivs = pendulumODE(t,curr" />
xTmO@*֔mH=„8o`&=JM{]JFMOb2DF4ʘ2mW׻0 ]/[2R.pWӡ:D$@!^v.^Ǩ*yAFk%5|o;j}Cs"p{X`d,@h %g,˴@.eGw­ c0K q1(*6i9%+uf@y2 4h˅#%r(c"ؐ-pO & u>~,R0a6 ʃBT[C)fy <2KqtlibFN3tEs pF2MQ%73`)%Gʬ 2yA"+ϒJ:91I=x)vbhٴCCd4g:9%q?Up.-)d95+ˈbȩ.HasX 8'dT?Ji@& S)&8~L~ .*&x^g[!(ͳ !"T9!dیmׂ-gM ki](B2̓8lk{kQ>96IY }/j7ؗj}7ثݏmQ箏j?joASѭwmErϏ)|ۿ7S

matlab老是显示input argument '' is undefined我没法在matlab上面运行我写的这东西,因为总是显示Input argument "currentValues" is undefined.Error in ==> pendulumODE at 10theta = currentValues(1);function derivs = pendulumODE(t,curr
matlab老是显示input argument '' is undefined
我没法在matlab上面运行我写的这东西,因为总是显示
Input argument "currentValues" is undefined.
Error in ==> pendulumODE at 10
theta = currentValues(1);
function derivs = pendulumODE(t,currentValues,L);
% Nonlinear Pendulum:(odefun)
%
% dTheta/dt = omega
% dOmega/dt = -gsin(theta)/L
%
% Our job is to set:dervis = [dTheta/dt; dOmega/dt]
% using the currentValues = [theta; omega].
g = 9.8; % m/s^2
theta = currentValues(1);
omega = currentValues(2);
dTheta = omega;
dOmega = -g*sin(theta)/L;
derivs = [dTheta; dOmega];
L = 0.248; % length in meters
initialValues = [0.5,0]; % theta(t=0) and omega(t=0)
timeSpan = [0 10]; % seconds
[t,theta] = ode45(@(t,v) pendulumODE(t,v,L),timeSpan,initialValues);
plot(t,theta)
xlabel('time (seconds)');
ylabel('\theta (blue),\omega (green)')

matlab老是显示input argument '' is undefined我没法在matlab上面运行我写的这东西,因为总是显示Input argument "currentValues" is undefined.Error in ==> pendulumODE at 10theta = currentValues(1);function derivs = pendulumODE(t,curr
currentValues还没有定义,所以theta = currentValues(1);这样的语句不能执行.
你的derivs是一个函数,调用它的时候应该把t,currentValues,L都传递给它才行.
以上.
专业路过的老狼