In this blog post, we explore incorrect calculations of the sine function sin(x) in MATLAB near numbers around
Example 1. Given that
and
calculate
and
in MATLAB.
Let's just post the figure directly.
From the above screenshot, it can be seen that the two outputs from MATLAB are
and
However, the correct values with 16 significant digits are -0.3077518861551721e-8 and 0.4106402475009074e-3, respectively (as provided by ISRealsoft).
Thus, the outputs of MATLAB contain 9 and 6 incorrect digits, with error rates of 9/16 = 56.25% and 6/16 = 37.5% respectively for the significant figures.
Top comments (0)