MATLAB: How can i display symbolic expressions using decimals instead of rational fractions

decimaldoubleexpressionnon numericsymsym2polysymbolicSymbolic Math Toolboxsyms

Hello,
When I express symbolic expressions using syms with decimal values, I often get very large fractions. Since the result is not constant, I cannot use double() to evaluate the result as a decimal. sym2poly() works in most cases, but one day I will probably need to evaluate a long expression that is not a polynomial. I have also tried sym(expression,'d') but this doesn't work for non-numeric inputs. Is there some way to display symbolic expressions using decimals?
Thanks!
Example:
syms SIG_X SIG_Y SIG_Z
S_bar = [[0.78,-0.35,-0.38];[-0.35,0.78,-0.38];[-0.38,-0.38,0.92]]; %[Pa]
alpha = [-0.018,24.3,24.3]*10^-6; %[/C]
stress = [SIG_X;SIG_Y;SIG_Z];
dT = 25;
strain = S_bar*stress+alpha'*dT';
disp(strain)
Result:
(39*SIG_X)/50 - (7*SIG_Y)/20 - (19*SIG_Z)/50 - 8500259669165361/18889465931478580854784
(39*SIG_Y)/50 - (7*SIG_X)/20 - (19*SIG_Z)/50 + 5603198512389277/9223372036854775808
(23*SIG_Z)/25 - (19*SIG_Y)/50 - (19*SIG_X)/50 + 5603198512389277/9223372036854775808
Desired Result:
0.78*SIG_X - 0.35*SIG_Y - 0.38*SIG_Z - 4.5e-07
0.78*SIG_Y - 0.35*SIG_X - 0.38*SIG_Z + 6.075e-04
0.92*SIG_Z - 0.38*SIG_Y - 0.38*SIG_X + 6.075e-04

Best Answer

Dennis, you could use something like
vpa(strain,5)