Bernstein gives unstable plots
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Torsten
el 15 de En. de 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.
Respuestas (1)
Walter Oevel
el 15 de En. de 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.
0 comentarios
Ver también
Categorías
Más información sobre Polynomials en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!