Question: Round - off error can ofteh accumulate when performing computations with repeated additions and subtractions. The error accumulates differently depending on the precision with which

Round-off error can ofteh accumulate when performing computations with repeated additions and subtractions. The error accumulates differently depending on the precision with which the numbers are stored. To demonstrate this concept, consider the following summation:
x=5-i=15000000.00001
The analytical result for x is exactly zero, but you will find that x does not equal zero when performing this computation with MATLAB due to the finite precision with which numbers are stored in memory. For this problem, write a script that performs the computation two different ways:
Use all double precision (MATLAB's default numbers) numbers in the calculation. Assign the result for x to the variable named ZeroDouble.
Use all single precision numbers* in the calculation. Assign the result for x using single precision to the variable named Zerosingle.
"(to create a single precision number, the following can be used single(0.00001))
Solve this problem using matlab code that uses vectors (i.e. do not use a loop in your solution.)
Hint: Declare a vector of size 500,0001 containing the value 0.00001 for each entry and then use the sum command.
 Round-off error can ofteh accumulate when performing computations with repeated additions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!