非线性积分方程组中含变限积分fsolve数值求解报错: Limits of integration must be double or single scalars
Show older comments
问题描述:
待求方程组{f1=0, f2=0, f3=0}中包含变量pl以及pr,pl和pr的表达式中包含上限是变量的积分(代码中加粗部分)。在通过matlabFunction处理为匿名函数后,int被integral替代,而integral不支持变量作为上下限,故报错:
Error using integral
Limits of integration must be double or single scalars.
可能有用的参考:
https://www.zhihu.com/question/46915508
这是我找到的一个相近的问题,但是我看不懂。。。
问题代码:
++++++++++++++++++++++++++
% 参数定义部分省略
beta = atan(x1/y1);
xL = sqrt(x1^2+y1^2)*cos(pi-alph-beta);
DL = sqrt(x1^2+y1^2)*sin(pi-alph-beta);
xR = sqrt(x1^2+y1^2)*cos(beta-alph);
DR = sqrt(x1^2+y1^2)*sin(beta-alph);
LL = DL^2+(xL-x)^2;
RR = DR^2+(xR-x)^2;
pl = -12*mu_L*rho_S^4*h_m^3*Uratio^3*(Uratio*int(LL^2*x,0,x)+C*int(LL^1.5, 0,x))/(rho_L*T0^3*K_L^3)+P0;
pr = -12*mu_L*rho_S^4*h_m^3*Uratio^3*(Uratio*int(RR^2*x,0,x)+C*int(RR^1.5, 0,x))/(rho_L*T0^3*K_L^3)+P0;
% 对pl和pr进行定积分,得到目标方程组
f1 = int(pl*x,x,-L,0)+int(pr*x,x,0,L)+M/d;
f2 = int(pl,x,-L,0)*sin(alph+tilt)+int(pr,x,0,L)*sin(alph-tilt)-G/d-2*L*P_e*sin(alph)*cos(tilt);
f3 = int(pl,x,-L,0)*cos(alph+tilt)-int(pr,x,0,L)*cos(alph-tilt)+2*L*P_e*sin(alph)*sin(tilt);
% 进行求解
% 初始值猜测
initial_guess = [0.5, 0.1, 2];
% 定义求解函数
equations = matlabFunction(f1,f2,f3, 'Vars', {x1, y1, Uratio});
% 使用fsolve求解方程组
result = fsolve(@(vars) equations(vars(1), vars(2), vars(3)), initial_guess);
+++++++++++++++++++++++++++++++++
Accepted Answer
More Answers (0)
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!