matlab calculates cosine different from my calculator
8 views (last 30 days)
Show older comments
Agnes Brogeby
on 8 Apr 2020
Commented: Star Strider
on 8 Apr 2020
If i calculate cos(1) in matlab I get ans=0.5403 whereas my calculator says 0.9998, what am I missing?
1 Comment
Accepted Answer
Star Strider
on 8 Apr 2020
Your calculator is calculating in degrees. By default MATLAB calculates in radians:
MATLAB = cos(1)
Calculator = cosd(1)
produces:
MATLAB =
0.540302305868140
Calculator =
0.999847695156391
Use the MATLAB cosd function (and the other ‘d’ trigonometric functions) to calculate in degrees.
2 Comments
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!