【发布时间】:2015-03-06 03:46:50
【问题描述】:
我正在尝试编写一些 matlab 代码。为什么我的新变量 w 不被接受,以便我的函数可以采用另一个参数?我想迭代现在是 7.8 的变量并改用迭代。
function dZ=sys(x,Z,w)
c=@(z)4800 - 20.2090 + (17.3368)*z/1000+ (272.9057)*exp(-z*0.7528/1000); % c(z)
c=c(2000);
deg=w;
% Z(1):=z
% Z(2):=u
dZ=zeros(2,1); % a column vector
dZ(1)=Z(2);
dZ(2)=-(c/cosd(7.8))^2*(((-272.9057*0.7528/1000)*exp(-Z(1)*0.7528/1000)) + 17.3368/1000)/...
(4800 - 20.2090 + (17.3368)*Z(1)/1000+ (272.9057)*exp(-Z(1)*0.7528/1000))^3;
end
尝试在我以前有效的函数中使用新变量时,我收到一条错误消息。
Error using sys (line 4)
Not enough input arguments.
Error in odearguments (line 88)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 114)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in underwater (line 2)
[X,Z]=ode45(@sys,x,[2000 tand(7.8)], 7.8);
【问题讨论】:
标签: matlab