如何用matlab解以下方程:x=91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x

3个回答

  • 看看solve这个命令.在matlab命令行上敲入:

    solve('91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x)/x+1)+1.83/(0.084*(100-x)/x+1)+1.68/(0.0251*(100-x)/x+1)+1.32/(0.0075*(100-x)/x+1)+0.97/(0.00092*(100-x)/x+1)-x')

    我看了结果是跟那两位的一样,得到7个解,不过x=0显然不是解,估计是matlab的BUG.

    因0不能作分母.一个笨方法是逐个带入求解,有matlab函数subs可以解决.

    如下:

    xx=solve('91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x)/x+1)+1.83/(0.084*(100-x)/x+1)+1.68/(0.0251*(100-x)/x+1)+1.32/(0.0075*(100-x)/x+1)+0.97/(0.00092*(100-x)/x+1)-x')

    xx =

    9.5928722289771455041249312194069

    -51.25070353762559926595511337666

    100.0

    -1.7631487189817605177017457928844

    -7.4742012011826256018294334313148

    -0.34893975376738034980285890672882

    0

    subs('91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x)/x+1)+1.83/(0.084*(100-x)/x+1)+1.68/(0.0251*(100-x)/x+1)+1.32/(0.0075*(100-x)/x+1)+0.97/(0.00092*(100-x)/x+1)-x','x',xx(1))

    ans =

    1.4541648269870039213039013706974*10^(-37)

    >> subs('91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x)/x+1)+1.83/(0.084*(100-x)/x+1)+1.68/(0.0251*(100-x)/x+1)+1.32/(0.0075*(100-x)/x+1)+0.97/(0.00092*(100-x)/x+1)-x','x',xx(2))

    ans =

    (-1.2652826131748627602783043114906)*10^(-36)

    >> subs('91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x)/x+1)+1.83/(0.084*(100-x)/x+1)+1.68/(0.0251*(100-x)/x+1)+1.32/(0.0075*(100-x)/x+1)+0.97/(0.00092*(100-x)/x+1)-x','x',xx(3))

    ans =

    1.0285575569695015694726444700695*10^(-38)

    >> subs('91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x)/x+1)+1.83/(0.084*(100-x)/x+1)+1.68/(0.0251*(100-x)/x+1)+1.32/(0.0075*(100-x)/x+1)+0.97/(0.00092*(100-x)/x+1)-x','x',xx(4))

    ans =

    (-5.8344113438106212736497260726423)*10^(-40)

    >> subs('91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x)/x+1)+1.83/(0.084*(100-x)/x+1)+1.68/(0.0251*(100-x)/x+1)+1.32/(0.0075*(100-x)/x+1)+0.97/(0.00092*(100-x)/x+1)-x','x',xx(5))

    ans =

    3.2984175096138360958310753236859*10^(-36)

    >> subs('91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x)/x+1)+1.83/(0.084*(100-x)/x+1)+1.68/(0.0251*(100-x)/x+1)+1.32/(0.0075*(100-x)/x+1)+0.97/(0.00092*(100-x)/x+1)-x','x',xx(6))

    ans =

    2.8887019080459322775106987459902*10^(-41)

    >> subs('91.83/(2.07*(100-x)/x+1)+2.37/(0.359*(100-x)/x+1)+1.83/(0.084*(100-x)/x+1)+1.68/(0.0251*(100-x)/x+1)+1.32/(0.0075*(100-x)/x+1)+0.97/(0.00092*(100-x)/x+1)-x','x',xx(7))

    ? Error using ==> mupadfeval at 28

    Error: Division by zero [_power];

    during evaluation of 'mlsubs'

    Error in ==> sym.subs at 219

    G = sym(mupadfeval('mlsubs', charcmd(G), [x '=' charcmd(y)]));

    最后带入0,出错了,因此是头6个解,看结果都已经到10的-30次方以下了,精度够了.