how to change the precision of symbolic variables.
2 次查看(过去 30 天)
显示 更早的评论
s^3*246655351680430349161861489360895748665691918000757954295365632i - s^2*(36212255157820456428489768408649977023491870935380775514669056 + 578091697775954585022159881976519846765626019509350787237019648i) - s*(130062300639770074374222879395026417216202027377365642475732992 + 861105664727459103565145461543508318180271162190507702581460992i) - (223478472834610436324352002622703850555766990429849990494534772 + 585856833391770884939511626951491940256735302346867433027453683i)
I need it to be 6 digit precised.
0 个评论
回答(1 个)
Star Strider
2019-10-1
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 个评论
Star Strider
2019-10-1
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Analog Filters 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!