nth root using sym class

2 ビュー (過去 30 日間)
John
John 2011 年 11 月 16 日
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.

回答 (1 件)

Andrew Newell
Andrew Newell 2011 年 11 月 17 日
If you have R2011b, you could use solve, for example,
y = solve(x^3-5,'Principal value','true');

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by