how to change the precision of symbolic variables.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
s^3*246655351680430349161861489360895748665691918000757954295365632i - s^2*(36212255157820456428489768408649977023491870935380775514669056 + 578091697775954585022159881976519846765626019509350787237019648i) - s*(130062300639770074374222879395026417216202027377365642475732992 + 861105664727459103565145461543508318180271162190507702581460992i) - (223478472834610436324352002622703850555766990429849990494534772 + 585856833391770884939511626951491940256735302346867433027453683i)
I need it to be 6 digit precised.
0 Kommentare
Antworten (1)
Star Strider
am 1 Okt. 2019
syms s
p = s^3*246655351680430349161861489360895748665691918000757954295365632i - s^2*(36212255157820456428489768408649977023491870935380775514669056 + 578091697775954585022159881976519846765626019509350787237019648i) - s*(130062300639770074374222879395026417216202027377365642475732992 + 861105664727459103565145461543508318180271162190507702581460992i) - (223478472834610436324352002622703850555766990429849990494534772 + 585856833391770884939511626951491940256735302346867433027453683i);
p_vpa = vpa(p, 6)
producing:
p_vpa =
s^3*2.46655e+62i - s^2*(3.62123e+61 + 5.78092e+62i) - s*(1.30062e+62 + 8.61106e+62i) - (2.23478e+62 + 5.85857e+62i)
The expression retains full internal precision, so nothing is lost.
4 Kommentare
Star Strider
am 1 Okt. 2019
If you want to automatically determine what I call the ‘scaling factor’, use this:
scaling_factor = vpa(10.^-fix((log(coeffs(p))/log(10))))
where ‘p’ is your polynomial of interest.
Experiment to get the result you want.
Siehe auch
Kategorien
Mehr zu Digital Filtering 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!