A set of 11 data points is given in the attached Excel spreadsheet: PS5_prob1_FD_data.xlsx. Task: Perform numerical differentiation to approximate the second derivative of the provided data. In doing so, address the following prompts: 1. Write your own MATLAB code to perform an appropriate Finite Difference (FD) approximation for the second derivative at each point in the provided data. Note: You are welcome to use the “lowest order” approximation of the second derivative f ′′(x). a) “Read in” the data from the Excel spreadsheet using a built-in MATLAB com- mand, such as xlsread, readmatrix, or readtable – see docs for more info. b) Write your own MATLAB function to generally perform an FD approximation of the second derivative for an (arbitrary) set of n data points. In doing so, use a central difference formulation whenever possible. c) Call your own FD function and apply it to the given data. Report out/display the results. 2. Reflect on your results by comparing to the exact solution. a) The tabulated data follows the trend of f (x) = e0.5x. Calculate the analytical second derivative of f ′′(x) by hand. Note: This calculation is very short, as we are just looking for the closed-form solution from calculus. b) Based on your result from (a), add a couple of lines of code to calculate and re- port out/display the “true error” (as a percentage) between your finite difference approximation and the exact analytical result: etrue = approx.−exact exact ×100%. Which points have the largest magnitude of error? Why? 11 data points xi e(x/2) 3.00 4.482 3.10 4.711 3.20 4.953 3.30 5.207 3.40 5.474 3.50 5.755 3.60 6.050 3.70 6.360 3.80 6.686 3.90 7.029 4.00 7.389
A set of 11 data points is given in the attached Excel spreadsheet: PS5_prob1_FD_data.xlsx.
Task: Perform numerical differentiation to approximate the second derivative of the
provided data. In doing so, address the following prompts:
1. Write your own MATLAB code to perform an appropriate Finite Difference (FD)
approximation for the second derivative at each point in the provided data. Note:
You are welcome to use the “lowest order” approximation of the second derivative f ′′(x).
a) “Read in” the data from the Excel spreadsheet using a built-in MATLAB com-
mand, such as xlsread, readmatrix, or readtable – see docs for more info.
b) Write your own MATLAB function to generally perform an FD approximation
of the second derivative for an (arbitrary) set of n data points. In doing so, use
a central difference formulation whenever possible.
c) Call your own FD function and apply it to the given data. Report out/display
the results.
2. Reflect on your results by comparing to the exact solution.
a) The tabulated data follows the trend of f (x) = e0.5x. Calculate the analytical
second derivative of f ′′(x) by hand. Note: This calculation is very short, as we
are just looking for the closed-form solution from calculus.
b) Based on your result from (a), add a couple of lines of code to calculate and re-
port out/display the “true error” (as a percentage) between your finite difference
approximation and the exact analytical result: etrue = approx.−exact
exact ×100%. Which
points have the largest magnitude of error? Why?
11 data points
xi e(x/2)
3.00 4.482
3.10 4.711
3.20 4.953
3.30 5.207
3.40 5.474
3.50 5.755
3.60 6.050
3.70 6.360
3.80 6.686
3.90 7.029
4.00 7.389
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images