Question: Rewrite this script without using any loops, using vectorized operations instead. Let us plot the decimal representation of the numbers in the system specified by
Rewrite this script without using any loops, using vectorized operations instead.
Let us plot the decimal representation of the numbers in the system specified by (beta,t,L,U) = (2,3,-2,3). The smallest possible number in the mantissa d_0.d_1d_2 is 1.00 and the largest possible number is 1.11 in binary, which is equal to 1 + 1/2+ 1/4 = 1.75. So, we will run in a loop from 1 to 1.75 in increments ofbeta^1-t = 2^-2 = 0.25. This is the basis for one loop. The exponent runs from -2 to 3, which is what we loop over in the second (nested) loop. The resulting double loop builds up an array with all the positive elements of the system. Here is a MATLAB script that plots the numbers of the system. Notice the format in the plot command. The resulting plot is in Figure 2.3. Note that the points are not distributed uniformly along the real line. The rounding unit for this system is eta = 1 /2 beta^1-t = 1 /2 times 2^1-3 = 1 /8, which is half the spacing between 1 = beta ^0 and the next number in the system. (Can you see why)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
