can we/how to leave roots in anwser

6 views (last 30 days)
marc
marc on 14 Sep 2011
Hi, is there a way to leave the roots in my final answer in the command window when I run my program ? I tried changing the format to rational, but it's not really what I want...I want fractions when the answer is a fraction but I don't want 1393/985 when the answer is simply sqrt(2). Does anyone know how to change that ? Thank you very much.

Answers (1)

Walter Roberson
Walter Roberson on 14 Sep 2011
MATLAB does not provide any way of doing this for numeric values.
If you have the symbolic toolbox, you could consider using that for your calculations.

Community Treasure Hunt

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

Start Hunting!