nth root using sym class
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello, I am new to Matlab and am trying to write a script to compute the roots of a quartic equation using analytical procedures. I am attempting to utilize my variables as sym objects so that I can control the numerical precision. The problem I am incurring, is that I have an expression that contains a cube root. It is my understanding that the nthroot() function is not compatible with the sym class. When I try to raise the term to the 1/3 power it produces complex roots when I need the real roots. Is there any way to compute the real cube root of a sym class variable?
P.S. I have found that I can convert to double for the desired expression and use the nthroot() function then convert back to the sym class, but I would prefer to keep everything sym if possible.
Thank You.
댓글 수: 0
답변 (1개)
Andrew Newell
2011년 11월 17일
If you have R2011b, you could use solve, for example,
y = solve(x^3-5,'Principal value','true');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!