finite difference formula in matlab

11 views (last 30 days)
julian lopez
julian lopez on 4 Sep 2021
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
Sulaymon Eshkabilov on 4 Sep 2021
It looks like a student assignment. Could you pl., show here your attempted actions (written codes)?

Sign in to comment.

Answers (0)

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!