Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 2. Truncation Errors due to Binary Representation The following expressi

ID: 2073527 • Letter: P

Question

Problem 2. Truncation Errors due to Binary Representation The following expressions are all exactly equal to zero: xi =1200-20. II, x-200-20.125 , x-200-0.21. However, computer stores floating-point numbers in the binary representation and some exact decimals like 0.1 are actually not exact binaries. Therefore, there are truncation errors in some of those floating-point numbers, which will accumulate in the summation series. As a result, not all of would be numerically identically zero. To verify the effect of error accumulation, use using Matlab's ,x,. Save[x,, x2, ,x.) as a row vector in A14. dat MATLAB to compute save -ascii command. Hint: Use abs. r,, ,

Explanation / Answer

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

****************************************************************************************

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote