我正在尝试使用Octave中的匿名函数使用quad
积分函数。我正在使用的代码是:
for i = 0:imax
t = i*dt;
theta = omega*t - k*xmid*cos(Angw) - k*ymid*sin(Angw);
eta = amp*cos(theta);
dz = (eta+h)/(nz-1);
dS = dz;
for j = 1:nz
z = -h + dz * (j-1)
u = (k*amp*g/omega)*((cosh(k*(h+z)))/cosh(k*h))*sin(theta)*cos(Angw);
v = (k*amp*g/omega)*((cosh(k*(h+z)))/cosh(k*h))*cos(theta)*sin(Angw);
w = (k*amp*g/omega)*((sinh(k*(h+z)))/cosh(k*h))*cos(theta);
udot = k*amp*g*((cosh(k*(h+z)))/cosh(k*h))*cos(theta)*cos(Angw);
vdot = -k*amp*g*((cosh(k*(h+z)))/cosh(k*h))*sin(theta)*sin(Angw);
wdot = -k*amp*g*((sinh(k*(h+z)))/cosh(k*h))*sin(theta);
% Velocity Vector Components
Vel = [u, v, w];
Acc = [udot, vdot, wdot];
Un = Vel*C;
Unx = Un(1);
Uny = Un(2);
Unz = Un(3);
Un_mag = sqrt(Unx^2 + Uny^2 + Unz^2);
% Force Components
Fd = Cd*0.5*rho*D*Un_mag*Vel;
Fi = Cm*rho*(pi*D^2/4.0)*Acc;
Ftot = @(x) ((Fd + Fi)*C);
Fx(j) = Ftot(:,1);
Fy(j) = Ftot(:,2);
Fz(j) = Ftot(:,3);
end
% Total force along the cylinder
ftotx = quad(Fx(j),-z,0)
end
我得到的错误是:
no default value for argument 1
我在第一个循环中正确计算Ftot,所以我很困惑为什么我不能这样做?我想在每个组件(Fx(j),Fy(j)和Fz(j))上单独集成Ftot。任何帮助将非常感激!
提前致谢!