finite difference formula in matlab

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 Kommentar

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 4 Sep. 2021
It looks like a student assignment. Could you pl., show here your attempted actions (written codes)?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 4 Sep. 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by