function Bv=polyvalB(n,x)
  Bv=zeros(1,length(x));
  for i=0:n
    Bv=Bv+factorial(n)/(factorial(i)*factorial(n-i))*f(i/n)*(x.^i).*(1-x).^(n-i);
  endfor
endfunction