When you are writing codes in Matlab®, sometimes you need to obtain more illustrative expressions to show the results to others. There is a way to do it in the Matlab® command window.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
Here, we will show you how to and why to use the ‘pretty()’ command in Matlab® with a very basic example below that is executed in the command window.
How To Use ‘pretty()’ Command In MatLab®?
>> syms a b= (a^2+3*a+1)/(8*a +3) - (a^6+6)/3; pretty(b) 2 6 a + 3 a + 1 a ------------ - -- - 2 8 a + 3 3 >>
First, we created a symbolic variable ‘a’ with ‘syms’ command to write our polynomial as coding. But you will appreciate that it is quite hard to read.
To illustrate it in command windows, we typed our function inside the ‘pretty()’ command. Take a look at the answer that is more illustrative than coding syntax.
Sometimes, this command can be very useful when you do presentations of your calculations or codes in Matlab®.
Do not forget to leave your comments and questions below about the use of the ‘pretty()’ command in Matlab® below.
If you want further coding examples about the ‘pretty()’ command in Matlab®, inform us in the comments.
This article is prepared for completely educative and informative purposes.
Your precious feedbacks are very important to us.