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

In a fashion similar to Step 1: e =1 Step 2: If 1+e is less than or equal to 1,

ID: 3637824 • Letter: I

Question

In a fashion similar to
Step 1: e =1
Step 2: If 1+e is less than or equal to 1, then go to Step 5. Otherwise go to Step 3.
Step 3: e =e /2
Step 4: Return to Step 2
Step 5:e =e *2

create an m-file to determine the smallest positive real number in MATLAB. Base your algorithm on the notion that your computer will be unable to reliably distinguish between zero and a quantity that is smaller than this number. DO NOT use the built in function 'realmin'.

I have tried making this script on my own but when I run it never stops running probably because it takes so many divisions to reach that smallest number.

Explanation / Answer

the script file is ------------------------------------------------ e=1; while(1+e >1) e=e/2; end e=e*2; disp(e); -------------------------------------------------- output: 2.2204e-016

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