help with expressing a function
조회 수: 2 (최근 30일)
표시 이전 댓글
Hi, can someone please explain why i get this and not, 0.006366*cos(t)?

댓글 수: 0
채택된 답변
Walter Roberson
2020년 10월 11일
syms t
sym(2/pi*0.01, 'd') * cos(t)
The reason you are getting what you are getting, is that the default symbolic conversion of floating point number to symbolic number, is for the floating point number to be converted to rational. Well, not really rational as such: it is extended to include sqrt(), and pi.
You can specifically tell MATLAB to convert floating point into software floating point by using the 'd' flag.
Or you can convert after the fact by using vpa() on the result you got.
댓글 수: 0
추가 답변 (1개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!