Finding approximate real solution to a equation

25 次查看(过去 30 天)
Can anyone please help me, how to find the approximate real solution to the following polynomial:
syms x
eqn=0.0941*x^3+0.1926*x-1500;
I used solve and simplify functions, but I don't get a real value.

采纳的回答

Alan Stevens
Alan Stevens 2021-9-22
You don't need syms here. Try the roots function.
help roots
  3 个评论
Alan Stevens
Alan Stevens 2021-9-22
You could try something like
coeffs = [0.0941, 0, 0.1926, -1500];
r = roots(coeffs);
indicator = find(r==real(r));
disp(r(indicator))
25.1400

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by