필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
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
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 CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by