Question: +) | 100% Please turn in the following items in a single zipfil one MATLAB script and four MATLAB functions. Write your name in a
+) | 100% Please turn in the following items in a single zipfil one MATLAB script and four MATLAB functions. Write your name in a comment in each .m file. Problem 1. Write four MATLAB functions that computes the forward difference, backward difference, central difference and Richardson extrapolation approximations to f'(zo). The inputs of each of them are: the name of the function, zo and h. The output is the difference approximation. For example, the first line of the function that computes the forward difference approximation should read: function ApproxDeriv - ForvardDiff (tyFun,xo,h) For the following two problems, assume that f(x) = sinx Problem 2. In a MATLAB script, provide the code that computes four types of difference approximations to f(1) using three values of h: 0.1, 0.01 and 0.001. That is, your code should produce four vectors, each with three entries: The ith entry in the jth vector is the jth type of difference approximation computed using the ith h value. For example, the second entry in the third vector is the central difference approximation to f'(1) computed using h 0.01. Problem 3. Read Section 1.1.4 of the textbook to learn how to display a table. Then in the same MATLAB script, provide the code that displays a table containing the errors associated with all the difference approximations computed in Problem 2. The error associated with a difference approximation is the absolute value of the difference between the approximate and true derivatives. The table should have five columns and four rows: the first row is a heading; below the heading of the table, the first column contains the three h values, and the second (or third or fourth or fifth) column contains the three errors associated with the second (or third or fourth or fifth) type of difference approximations. All errors should be displayed in the 5.2e format. More examples of tables can be found on p 12, p. 52 and p. 54 of the textbook
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
