Problem 2. Truncation Errors due to Binary Representation The following expressi
ID: 3891259 • Letter: P
Question
Problem 2. Truncation Errors due to Binary Representation The following expressions are all exactly equal to zero: However, computer stores floating-point numbers in the binary representation and decimals like 0.1 are actually not exact binaries. Therefore, there are truncation errors in some a those floating-point numbers, which will accumulate in the summation series. As a result, not all of x,,x2, , MATLAB to computex,, , ,x, . Save [x,?, ,x) as a row vector in A14. dat using Matlab's save -ascii command. Hint: Use abs. some exact r, would be numerically identically zero. To verify the effect of error accumulation, useExplanation / Answer
MATLAB CODE:
x1=abs(200-0.1*2000); %calculating value of x1
x2=abs(200-0.125*1600); %calculating value of x2
x3=abs(200-0.2*1000); %calculating value of x3
x4=abs(200-0.25*800); %calculating value of x4
x5=abs(200-0.4*500); %calculating value of x5
x6=abs(200-0.5*400); %calculating value of x6
A14=[x1 x2 x3 x4 x5 x6] %saving all values in matrix A14
save A14.dat-ascii %saving as A14.dat
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.