10
Precision and Errors
After studying this chapter, you should be able to:
- understand various errors and their sources
- perform precise computations
- write MATLAB® code for accurate results
10.1 Introduction
Though in everyday life, numbers are almost exclusively represented using the base 10 decimal system, computers use a base 2 system, which is called binary system. An integer N is represented in an n-bit system as,
N = (an−1..aj..a1a0 = an−1 × 2n−1 + a1 × 21 + a0 × 20
where ai′s are only 0 or 1. An example of a binary number in an 8-bits system is as follows:
N = (01101101)2 = 0 ×27 + 1 × 26 + 1 × 25 + 0 × 24 + 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20
You can determine the binary representation of integers in MATLAB by the command dec2bin ...
Get Programming in MATLAB ® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.