How to solve symbolic equation with double coefficients in matlab?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 01:57:18

问题


I have quadratic equation 1/x = 1/(a-x) + 1/(3*a -x)

I want to solve it in matlab:

solve('1/x=1/(a-x)+1/(3*a-x)', 'x')
ans =
 (4/3+1/3*7^(1/2))*a
 (4/3-1/3*7^(1/2))*a

Is there any way to solve equation with float coefficient? Like

ans = 
  2.215250437021530*a
  0.451416229645136*a

回答1:


Apparently, double(ans) should convert it for you.




回答2:


I used eval() to get a double result from a symbolic expression



来源:https://stackoverflow.com/questions/881010/how-to-solve-symbolic-equation-with-double-coefficients-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!