Solve a nonlinear function with one variable
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I need to solve this function using Matlab in single script:
x - x^2 + 2*{sin(x)*(x-1)} = 0
Would you be able to provide a sample code and method to do this in Matlab?
Thank you very much
댓글 수: 0
답변 (2개)
Sulaymon Eshkabilov
2023년 1월 16일
It is quite simple to solve this exercise. Just use vpasolve(), e.g.:
syms x
Solution = vpasolve(x-x^2+2*sin(x)*(x-1)==0)
An alternative way is to try Newton-Raphson method
댓글 수: 2
Sulaymon Eshkabilov
2023년 1월 16일
if you are talking about NR method, see this explanation. You'd need to use [for .. end] or [while ... end] loop. See this link where a bunch of matlab codes and discussions of NR method.
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!