i used format shortg but still the result is come in e format and fraction

13 views (last 30 days)
format shortg
syms c
h=2.4;
k=4;
c11=106.8;
c33=54.57;
c13=9.68;
c15=0.28;
c35=-1.69;
c55=25.05;
r1=2727;
l=2.46;
u=5.66;
r2=7800;
n=2.54;
a01=c33*c55
a02=c35^2
a0=a01-a02
a211=c33+c55
a21=a111*r1
a22=2*c15*c35
a23=c11*c33
a24=c13^2
a25=2*c13*c55
a2=a21*(c^2)-a22-a23+a24+a25
the value a21 is come in the form of e and value of a2 come in the fraction form. how can i solve this problem.
a01 =
1367
a02 =
2.8561
a0 =
1364.1
a211 =
79.62
a21 =
2.1712e+05
a22 =
-0.9464
a23 =
5828.1
a24 =
93.702
a25 =
484.97
a2 =
(7460314899881657*c^2)/34359738368 - 3606713698942451727/687194767360000
>>

Accepted Answer

Walter Roberson
Walter Roberson on 6 Aug 2022
a2 come in the fraction form
That is expected for format short. When using format short, all values greater than 100000 that are not integers, are displayed in scientific notation; and from 1e9 onward, all integers are also displayed in scientific notation.
shortg is intended to be compact and to line up in columns, so it switches to scientific notation when the number of characters would be too large.
7460314899881657*c^2)/34359738368 - 3606713698942451727/687194767360000
That is a symbolic expression You can display it in a floating point format (that ignores the "format" command) by using vpa
Alternately, you can use sympref to set the default symbolic output to be floating point format (I do not recommend setting this default.)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!