Is this the correct way to factor out denominator and nominator of this complex expression?
3 views (last 30 days)
Show older comments
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))
F1= factor(N)
F2= factor(D)
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".
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1481821/image.png)
1 Comment
Paul
on 14 Sep 2023
Just want to point out that the expression entered into numden doesn't match the expression in the problem statement.
Answers (1)
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
0 Comments
See Also
Categories
Find more on Symbolic Variables, Expressions, Functions, and Preferences in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!