Bernstein gives unstable plots

6 views (last 30 days)
Sahithi Chaganti
Sahithi Chaganti on 12 Jan 2016
Commented: Torsten on 15 Jan 2016
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 Comment
Torsten
Torsten on 15 Jan 2016
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.

Sign in to comment.

Answers (1)

Walter Oevel
Walter Oevel on 15 Jan 2016
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.

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!