Finding approximate real solution to a equation

조회 수: 26 (최근 30일)
Vinit Nagda
Vinit Nagda 2021년 9월 22일
댓글: Vinit Nagda 2021년 9월 22일
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
Vinit Nagda
Vinit Nagda 2021년 9월 22일
Thank you very much @Alan Stevens

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

추가 답변 (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