sym function help

Hi,
I'm trying to write a short script file to quickly calculate some values.
My question is about using the the sym function. I have the code
w = sym('w');
to denote that i want w to be understood as a symbol.
the problem is that the returned value is in a very hard to understand form. I know my equation is correct so that is not the problem. For example, matlab will return
Zc =
((944473296573929*w*(3/2000 - (295147905179352825856*i)/(681791660964305*w) + (1702413117074507*w*i)/2361183241434822606848)*i)/1180591620717411303424 + (819854011140975/1152921504606846976 + (6876370061968011*w*i)/9671406556917033397649408)*(3/2000 - (295147905179352825856*i)/(681791660964305*w) + (1702413117074507*w*i)/2361183241434822606848) + (944473296573929*w*(819854011140975/1152921504606846976 + (6876370061968011*w*i)/9671406556917033397649408)*i)/1180591620717411303424)/(3/2000 - (295147905179352825856*i)/(681791660964305*w) + (1702413117074507*w*i)/2361183241434822606848)
Is there a way for matlab to simplify this further? i.e., why doesn't matlab simplify some of the divisions?
Thanks for any input.

 Accepted Answer

double(Zc)
or
simplify(Zc)
or
subs(Zc,w,value)
or
simple(ZC)
just throwing a few things out there for you.

More Answers (1)

Walter Roberson
Walter Roberson on 3 Jun 2011

0 votes

MuPad only automatically simplifies divisions involving numeric constant values. Apply simplify() to get a more compact expression.

Community Treasure Hunt

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

Start Hunting!