フィルターのクリア

how can i write a code to find maximum error in Lagrange polynomial for given functions?

4 ビュー (過去 30 日間)
norah
norah 2023 年 5 月 9 日
コメント済み: Torsten 2023 年 7 月 21 日
im having defficulties in writing matlab cod to
  • Find the maximum error in using to approximate on the interval [0, 2]. can any one help?

回答 (1 件)

Torsten
Torsten 2023 年 5 月 10 日
編集済み: Torsten 2023 年 5 月 10 日
Choose a fine enough grid x on [0,2], evaluate your function(s) f(x) and the Lagrange polynomial(s) L(x) for the grid points and build abs(f(x)-L(x)). This should give you a good approximate value for the maximum error on [0,2].
  2 件のコメント
Alvira Yawar
Alvira Yawar 2023 年 7 月 20 日
Hi can you please share a sample program for the same
Torsten
Torsten 2023 年 7 月 21 日
If L_eval is your function for evaluating the Lagrange polynomial, you can use
x = linspace(0,2,100);
max_error = max(abs(f(x)-L_eval(x)))

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

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by