Symbolic simplify not cancelling fractions

8 views (last 30 days)
I'm trying to use the symbolic simplify function, but I'm not getting the output that I would like. I am getting;
(8*cos(t) - 8*cos^3(t))/4
The code I am using is;
symbols = expand(symbols)
symbols = simplify(symbols, 'Steps', 100);
Is there any way to cancel the factor of 4 in both the numerator and denominator?
Many thanks.

Answers (1)

John D'Errico
John D'Errico on 12 Mar 2016
Works fine for me, with nothing special done at all. Of course, I had to fix your mistaken syntax.
(8*cos(t) - 8*cos(t)^3)/4
ans =
2*cos(t) - 2*cos(t)^3
cos^3(t) is NOT valid syntax in MATLAB.
  1 Comment
Thomas Prideaux-Ghee
Thomas Prideaux-Ghee on 12 Mar 2016
Edited: Thomas Prideaux-Ghee on 12 Mar 2016
I am simplifying a far more complicated expression (that exceeds the length limit on the Matlab console). My final result contains is what I posted above (but of course without the syntax error).
It turns out that running simplify again (like you suggested) works - for some reason the first simplify wasn't doing enough! Thanks :)

Sign in to comment.

Categories

Find more on Creating and Concatenating Matrices 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!