finite difference formula in matlab
10 views (last 30 days)
Show older comments
1 Using MATLAB, write a program (.m file) to compute an approximate value of the derivative of a function using the following finite difference formula.
2 Test your program using the function tan 𝑥 for 𝑥 = 1. Determine the error by comparing with the square of the built-in function sec (𝑥).
3 Graph the magnitude of the error as a function of ℎ, for ℎ = 10^(−k), 𝑘 = 0,…, 16. You should use logarithmic scale for ℎ and also for the magnitude of the error.
4 Is there a minimum value for the magnitude of the error?
5 How does the corresponding value for ℎ compare with the rule of thumb ℎ ≈ √𝜀𝑚𝑎𝑐ℎ?
6 Repeat items 1 through 5 using the central difference approximation.
1 Comment
Sulaymon Eshkabilov
on 4 Sep 2021
It looks like a student assignment. Could you pl., show here your attempted actions (written codes)?
Answers (0)
See Also
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!