function y=Bern(i,n) % 递归方法生成n阶Bernstein多项式的第i个函数 % NUMERICAL METHODS: Matlab Programs % (c) 2007 by Xie Liling % Complementary Software to accompany the textbook: % Information and Computing Science: A Laboratory Course if i>n || i<1 y=0; elseif i==1 && n==1 y=1; else y1=conv(Bern(i,n-1),poly(1))*(-1); y2=conv(Bern(i-1,n-1),poly(0)); r=length(y1);s=length(y2); if r>s y2=[zeros(1,r-s) y2]; end if r