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!