Question: 2. Use MATLAB to plot the function f(x) = (5 - x) exp(x)-5, for x between 0 and 5. (This function is associated with

2. Use MATLAB to plot the function f(x) - (5 - x) exp(x)-5, for x between O and 5. (This function is associated with the Wien radiation law, which gives a method to estimate the surface tempera- ture of a star.) (a) Write a bisection routine or use routine bisect available from the books web page to find a root of f(x) in the interval [4, 5], accurate to six decimal places (i.e., find an interval of width at most 10° that contains the root, so that the 7 midpoint of this interval is within 5 x 10 of the root). At each step, print out the end- points of the smallest interval known to con tain a root. Without running the code further, answer the following: How many steps would be reguired to reduce the size of this interval to 12 10?Explain your answer.

2. Use MATLAB to plot the function f(x) = (5 - x) 

2. Use MATLAB to plot the function f(x) = (5 - x) exp(x)-5, for x between 0 and 5. (This function is associated with the Wien radiation law, which gives a method to estimate the surface tempera- ture of a star.) (a) Write a bisection routine or use routine bisect available from the book's web page to find a root of f(x) in the interval [4, 5], accurate to six decimal places (i.e., find an interval of width at most 10-0 that contains the root, so that the midpoint of this interval is within 5 x 10-7 of the root). At each step, print out the end- points of the smallest interval known to con- tain a root. Wwithout running the code further, answer the following: How many steps would be required to reduce the size of this interval to 1012? Explain your answer. (b) Write a routine to use Newton's method or use routine newton available from the book's web page to find a root of f(x), using initial guess Xo = 5. Print out your approximate solution x and the value of f(xp) at each step and run %3D until |f(x) s 10-8. Without running the code further, but perhaps using information from your code about the rate at which | f(xp) is re- duced, can you estimate how many more steps would be required to make | f(xpl s 10-16 (assuming that your machine carried enough decimal places to do this)? Explain your an- swer. (c) Take your routine for doing Newton's method and modify it to run the secant method. Re- peat the run of part (b), using, say, xo = 4 and %3D X1 = 5, and again predict (without running the code further) how many steps would be required to reduce |f(x) below 10 16 (assum- ing that your machine carried enough decimal places to do this) using the secant method. Ex- plain your answer.

Step by Step Solution

3.51 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Please find below the required MATLAB Code for part a and b clear all close all clc syms x f symfun5... View full answer

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 Economics Questions!