Bernstein gives unstable plots

2 次查看(过去 30 天)
Sahithi Chaganti
Sahithi Chaganti 2016-1-12
评论: Torsten 2016-1-15
Following is my code
syms t
b3 = bernstein(@(t) 1/(1 + 25 * t^2), 3, t);
b10 = bernstein(@(t) 1/(1 + 25 * t^2), 10, t);
b100 = bernstein(@(t) 1/(1 + 25 * t^2), 100, t);
ezplot(1/(1 + 25 * t^2),[0,1])
hold on
ezplot(b3,[0,1])
ezplot(b10,[0,1])
ezplot(b100,[0,1])
legend('sine function','3rd-degree polynomial',...
'10th-degree polynomial','100th-degree polynomial')
title('Bernstein polynomials')
hold off
figure
ezplot(1/(1 + 25 * t^2),[-1,1])
hold on
ezplot(b3,[-1,1])
ezplot(b10,[-1,1])
ezplot(b100,[-1,1])
legend('sine function','3rd-degree polynomial',...
'10th-degree polynomial','100th-degree polynomial')
title('Bernstein polynomials')
hold off
Why does Bernstein result in unstable values over the interval [-1,1]? From the documentation of Bernstein function, I understand that Bernstein polynomial approximates the function f over the interval [0,1]. What to do if I need the Bernstein polynomial to approximate a function over the interval [-1,1].
  1 个评论
Torsten
Torsten 2016-1-15
B_[a:b](x)=B_[0:1]((x-a)/(b-a))
Bernstein polynomials on [a:b], evaluated at x, are just the Bernstein polynomials on [0:1], evaluated at t=(x-a)/(b-a).
Best wishes
Torsten.

请先登录,再进行评论。

回答(1 个)

Walter Oevel
Walter Oevel 2016-1-15
Hi Saithi,
why do you expect the Bernstein representation to be numerically stable on [-1, 1]? It is designed to be stable on [0, 1] only. However, it is not invariant under the transformation t -> -t, although the original function is and the expanded/simplified version of the Bernstein polynomial is, too (note, however, that the latter is not a numerically stable representation).
The work-around may be the following: subtitute t^2 by y in the original function, do a Bernstein expansion w.r.t. y, then substitute back y by t^2. Of course, this is not the same as the Bernstein expansion of a given degree w.r.t. t, but it might do for your purposes.

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by