Using the 'solve' function

余生颓废 提交于 2019-12-12 04:55:38

问题


I would like to solve an equation for x, and i know that there are atleast two solutions,which means that jj will be a vector. I need the largest of those solutions - that is were max(jj) comes into play. However z = max(jj) will give me the biggest number, but it does not evaluate it. for example z could be = 2*3^4 + 1 . In this form i can't send this "number" to another function which I want to do. the 'k' is a given number not a variable. (say k=10 or any other number)

syms x
eqn = x + (k/6)*(x^2 -1) ==0
jj =  solve(eqn,x)

z = max(jj)

回答1:


You are looking for a way to convert from symbolic to numeric form. There is a standard symbolic toolbox function for that: double.

z1=double(z)

should return the value of the expression in a double format array.



来源:https://stackoverflow.com/questions/28610908/using-the-solve-function

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