0
如何更改输入参数的顺序?对于fncA_approx()
,输入自变量是有序的(height, t
),这实际上是直观的。如何控制matlabFunction
输出的输入参数顺序,以便排列输入参数(t, height
)?如何订购生成函数的输入参数
%% 1.10 Torricelli's equation_; %'//
syms Qua t Area height alf
% (a)
%delta_Height = dsolve('Dheight = (3*Qua*((sin(t))^2) - (alf*(1+ height)^1.5))/Area', 'height(0) = 0')
% (b)
dHeight_dt = (3*Qua*(sin(t))^2 - alf*(1+ height)^1.5)/Area
fnca_approx = subs(dHeight_dt, {Area, Qua, alf}, {1250, 450, 150})
fncA_approx = matlabFunction(fnca_approx)
%%
step = 0.5;
t = 0:step:10;
height = ones(size(t));
k = 1;
height(1) = 0;
while k < length(t)
height(k + 1) = height(k) + step*fncA_approx(height(k),t(k));
k = k+1;
end;
height'