EMAE 250: Lab Assignment 2 1. Define the following function in MATLAB and save the m-file as “Lastnamefun.m”. Please find Jeongfun.m 2. Write an algorithm to approximate the root of the above function by using the bisection method. Let x l , x u , e d , and n be the input variables, where x l and x u are the lower and upper boundaries of the initial interval, e d is the desired error, and n is the number of iterations. Open a new m-file and save it as “LastnameBisec.m”. >> [xr, fr] = JeongBisec(n) Complete the following table when x l =0 and x u =1. e d = 0.1 e d = 0.05 e d = 0.01 x r f ( x r ) x r f ( x r ) x r f ( x r ) n = 3 0.3750 0.0918 n = 5 03438 -0.0889 n = 10 0.3584 -0.0048 3. Write an algorithm to compute the minimum number of iterations required for the desired error and save the m-file as “LastnameIter.m”. For each e d = 0.1, 0.05 and 0.01, what is the minimum number of iterations required to satisfy the desired error? >>n = JeongIter(ed)
This is the end of the preview. Sign up
access the rest of the document.
This note was uploaded on 11/14/2011 for the course EAME 250 taught by Professor Lee during the Spring '11 term at Case Western.