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'