www.gusucode.com > symbolic 源码程序 matlab案例代码 > symbolic/Bernstein2Example.m
%% Bernstein2 %% 1 % Copyright 2015 The MathWorks, Inc. f = @(x)rectangularPulse(1/4,3/4,x); b1 = bernstein(f, 100, sym('t')); b2 = simplify(b1); f1 = matlabFunction(b1); f2 = matlabFunction(b2); %% 2 t = 0:0.001:1; plot(t, f(t), t, f1(t), t, f2(t)) hold on legend('original function','Bernstein polynomial',... 'simplified Bernstein polynomial') hold off