www.gusucode.com > symbolic 源码程序 matlab案例代码 > symbolic/Bernstein1Example.m

    %% Bernstein1
%% 1
syms t
b10 = bernstein(@(t) sin(2*pi*t), 10, t);
b100 = bernstein(@(t) sin(2*pi*t), 100, t);
%% 2
fplot(sin(2*pi*t),[0,1])
hold on
fplot(b10,[0,1])
fplot(b100,[0,1])

legend('sine function','10th-degree polynomial',...
                      '100th-degree polynomial')
title('Bernstein polynomials')
hold off