使用Matlab / Maple查找非线性方程的根

时间:2014-11-28 01:40:43

标签: matlab symbolic-math maple equation-solving nonlinear-functions

我很难找到非线性方程的根。我已经尝试过Matlab和Maple,两者都给了我同样的错误

Error, (in RootFinding:-NextZero) can only handle isolated zeros

等式如

-100 + 0.1335600000e-5*H + (1/20)*H*arcsinh(2003.40/H)

等式中的变量为H

如何找到此等式的根(或近似根)?

Matlab代码: 功能文件:

function hor_force = horizontal(XY, XZ, Lo, EAo, qc, VA)
syms H
equation = (-1*ZZ) + (H/qc)*(cosh((qc/H)*(XZ- XB))) - H/qc + ZB;
hor_force = `solve(equation);`

主文件:

EAo = 7.5*10^7;
Lo = 100.17;
VA = 2002;

XY = 0;
ZY = 0;

XB = 50;
ZB = -2;

XZ = 100;
ZZ = 0;

ql = 40;

Matlab显示错误:

Error using sym/solve (line 22)
Error using maplemex
Error, (in RootFinding:-NextZero) can only handle isolated zeros

Error in horizontal (line 8)
hor_force = solve(equation);
Error in main (line 34)
h = horizontal(XY, XZ, Lo, EAo, ql, VA)

http://postimg.org/image/gm93z3b7z/

2 个答案:

答案 0 :(得分:2)

您不需要符号工具箱:

首先,创建一个匿名函数,可以在输入处使用向量(使用.*./

equation = @(H) ((-1*ZZ) + (H./qc).*(cosh((qc./H).*(XZ- XB))) - H./qc + ZB);

其次,创建一个向量,然后将其插入到等式中,以便近似地找到函数符号的变化。最后,使用fzerox0作为第二个输入参数。

H = linspace(1,1e6,1e4);  
x0 = H(find(diff(sign(equation(H)))));  %// Approximation of when the line crosses zero
x = fzero(equation, x0)  %// Use fzero to find the crossing point, using the initial guess x0
x =    
   2.5013e+04
equation(x)
ans =
     0

验证:

enter image description here

您可能需要查看this question以获取有关如何查找非多项式根的更多信息。

答案 1 :(得分:0)

在Maple中,使用您问题中的表达式

restart:

ee := -100 + 0.1335600000e-5*H + (1/20)*H*arcsinh(2003.40/H):

Student:-Calculus1:-Roots(ee, -1e6..1e6);

            [               5                           ]
            [-1.240222868 10 , -21763.54830, 18502.23816]

#plot(ee, H=-1e6..1e6, view=-1..1);