Question: Write a well commented MATLAB program to calculate the 1 st , 2 nd , and 3 rd derivative of an equation using forward finite

Write a well commented MATLAB program to calculate the 1st ,2nd , and 3rd derivative of
an equation using forward finite difference, backward finite difference and central finite
difference methods with an error of the second order O(h2
) for forward and backward finite
different methods and an error of 4th order for central finite method O(h4
).
In your program give the user the capability to insert the step size and the value at which
the derivative is to be calculated. Write the equation in a separate .m file as function.
5
2- Use your program to find the 1st,2nd, and 3rd derivatives of the following equation (f(x)=
x4+2x -
2
) at x=1 using two different values for the step size, the first value is h1=0.25
and the second one is h2=0.01.
Solution 1 at h1=0.25:
First_D_Forward=
Second_D_Forward =
Third_D_Forward =1.
First_D_Backward=
Second_D_Backward =
Third_D_Backward =
First_D_Central=
Second_D_Central =
Third_D_Central =
Solution 2 at h2=0.01:
First_D_Forward=
Second_D_Forward =
Third_D_Forward =1.
First_D_Backward=
Second_D_Backward =
Third_D_Backward =
First_D_Central=
Second_D_Central =
Third_D_Central =
6
Discussion and Analysis
1. Calculate the relative error in the answers for all methods found using h=0.25 assuming
that the answers found using step size h=0.01 is the right one

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!