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 件のコメント

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

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

質問済み:

2021 年 9 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by