matlab function "solve" couldn't solve correctly

syms x;
g=x.^2-sin(x+0.15);
s=solve(g==x)
hold on;
fplot(g);
fplot(x);
As above, the equation "x.^2-sin(x+0.15)==x" should have 2 answers. I can tell from the plot of g and x.
gx.png
While using the function " solve ", i could only get one answer as below.
Warning: Unable to solve symbolically. Returning a numeric approximation instead.
> In solve (line 304)
In test (line 3)
s =
-0.07234414896484352635594864867791
Does it happen when "solve" Unable to solve symbolically, or is there something with my way of solving this problem. Thank you guys in advance.

 채택된 답변

madhan ravi
madhan ravi 2019년 5월 15일

0 개 추천

fsolve(matlabFunction(g-x),[-1,2])
% you can also use vpasolve() with random set to true in a loop to see the possibilities

댓글 수: 1

it works!!!!!! thank you very much. btw, i tried vpasolve() and it doesn't solve correctly as well. Seemed like fsolve() works better on this equation.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

릴리스

R2017b

태그

질문:

2019년 5월 15일

댓글:

2019년 5월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by