Reference no: EM132206030
A) Write a MATLAB function that computes precision for a given reference value.
A prototype of the function is given here:
function [precision] = PrecisionVersusBase( base ) % returns precision
The algorithm for computing the precision is given in the pseudo code below
precision = base
WHILE( base + precision > base )
precision = precision / 2
precision = precision * 2
B) Using the function from part A, compute precision for a reference value equal to 1.0 to 1e-30, reducing it by a factor of 10 each step. ( base = base/10.0; ) Write out the results of each case to a Comma Separated Values (CSV) file*. Write out theprecision, and the base, along with the ratio of precision and base, in other words writeout base, precision and precision/base. Document these results in your report.
First, plot the base versus precision and then plot base versus the ratio. Consider theform and style of plot you are using, especially the x-axis. Due to the geometricnature in the progression of base, base/10 at each step, a log scale might be helpful.The MATLAB function loglog is the same as plot, except each axis (x and y) will use a log scale.