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 comentario

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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Function Creation en Centro de ayuda y File Exchange.

Preguntada:

el 4 de Sept. de 2021

Comentada:

el 4 de Sept. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by