Why are sine and cosine values inaccurate?
Ältere Kommentare anzeigen
Hi, I'm a medical researcher interested in DSP, and am trying to learn how to use MATLAB. I am just testing out basic functions, including sine and cosine functions. After inputting cos(pi/2) I got 6.1232e-17, and for sin(pi) I got 1.2246e-16. Clearly these are very close to the value 0 which I expected. But I am confused as to why it did not return zero. Is this round-off error?
thanks
Jem
Akzeptierte Antwort
Weitere Antworten (1)
Shashank Prasanna
am 19 Mär. 2013
1 Stimme
pi itself is an approximation. I would point you to this solutions page for some more insight to this behavior:
1 Kommentar
Jem
am 19 Mär. 2013
Kategorien
Mehr zu Get Started with Signal Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!