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?
0 个评论
回答(1 个)
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
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 Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!