large value explanation mixing sym vars with double
2 次查看(过去 30 天)
显示 更早的评论
Hello and thanks ahead for taking the time to answer my question. Please consider the following
a = wc*((s^2+200)/(10*s)) wc is assigned the value 1.2279 and 's' is a sym var.
when I execute the above code can someone explain to me why I get these rather large coefficients? Like where did these numbers even come from?
a =
(552840675468697*(s^2 + 200))/(4503599627370496*s)
I guess it has something to do with mixing doubles with sym vars, using VPA gives me what I'm looking for:
ans =
0.12275528937093427295224046247313*s + 24.551057874186854590448092494626/s
again can someone explain to me why this is? Thanks again.
0 个评论
回答(1 个)
Steven Lord
2015-10-23
When you perform computations like * using a double precision value and a symbolic variable, MATLAB converts the double precision value into a symbolic value. By default it does so by converting the double precision value into a rational or "nice" form. If it can't do that, it instead converts the double precision value exactly into N*2^e (in this case, 1/4503599627370496 is 2^(-52).) See the description of the 'r' and 'f' flags in the documentation for the SYM function for additional information.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!