Why are symbolic expressions being rounded?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bill Tubbs
am 2 Sep. 2020
Beantwortet: Bill Tubbs
am 3 Sep. 2020
I'm deriving some expressions symbolically and then substituting values and computing the results and I only recently noticed that the results are being rounded.
>> format long
>> syms x; double(subs(10/x,x,3))
ans =
3.333300000000000
or simply,
>> x = sym(3.33333333)
x =
3.3333
>> double(x)
ans =
3.333300000000000
>> syms x
>> p = sym(pi);
>> piVpa = vpa(p)
piVpa =
3.1416
According to the documentation, this is supposed to produce:
piVpa =
3.1415926535897932384626433832795
1 Kommentar
Akzeptierte Antwort
Weitere Antworten (1)
Steven Lord
am 2 Sep. 2020
Have you changed your digits setting?
help digits
Are you calling the correct double function? What does this show?
which double(x)
1 Kommentar
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!