Is this the correct way to factor out denominator and nominator of this complex expression?

3 views (last 30 days)
syms x
[N,D]= numden((x^5-2*x^4-18*x^3+4*x^2+49*x+30)/(3*x^2+23*x+36))
N = 
D = 
F1= factor(N)
F1 = 
F2= factor(D)
F2 = 
I have attached my code above and original question below. Also, I wasn't quite sure about the phrase "Print your results to the Command Window".

Answers (1)

Walter Roberson
Walter Roberson on 14 Sep 2023
When you have symbolic results, there are several different ways you can display them to the command window:
  • you can assign them to a variable in a statement that does not end in a semi-colon. The results will be automatically displayed as is shown in your Question
  • you can assign them to a variable in a statement that does end in a semi-colon. Then, at some later point, you can disp() the variable
  • you can char() a symbolic expression and use disp() or fprintf() with '%s' format to display the result. Or you can string() and disp() or fprintf() with '%s'
  • you can latex() a symbolic expression and text() it onto an axes with 'interpreter', 'latex'
  • you can pretty() a symbolic expression and display the result the command window; the result will be partly formatted
Note:
If you are using LiveScript and displaying a symbolic expression then the result will be nicely formatted, but if you char() or string() first or you display to the command window, then it will not be nicely formatted

Community Treasure Hunt

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

Start Hunting!