% Regression test function (black blox) for FreeMat v4.0
% This function is autogenerated by helpgen.
function bbtest_success = bbtest_polyfit
  bbtest_success = 1;
NumErrors = 0;
try
  x = linspace(0,1,20);

catch
  NumErrors = NumErrors + 1;
end
try
  y = sin(2*pi*x);

catch
  NumErrors = NumErrors + 1;
end
try
  plot(x,y,'r-')

catch
  NumErrors = NumErrors + 1;
end
try
  mprint polyfit1

catch
  NumErrors = NumErrors + 1;
end
if (NumErrors ~= 0) bbtest_success = 0; return; end
NumErrors = 0;
try
  p = polyfit(x,y,3)

catch
  NumErrors = NumErrors + 1;
end
try
  f = polyval(p,x);

catch
  NumErrors = NumErrors + 1;
end
try
  plot(x,y,'r-',x,f,'ko');

catch
  NumErrors = NumErrors + 1;
end
try
  mprint polyfit2

catch
  NumErrors = NumErrors + 1;
end
if (NumErrors ~= 0) bbtest_success = 0; return; end
NumErrors = 0;
try
  p = polyfit(x,y,11)

catch
  NumErrors = NumErrors + 1;
end
try
  f = polyval(p,x);

catch
  NumErrors = NumErrors + 1;
end
try
  plot(x,y,'r-',x,f,'ko');

catch
  NumErrors = NumErrors + 1;
end
try
  mprint polyfit3

catch
  NumErrors = NumErrors + 1;
end
if (NumErrors ~= 0) bbtest_success = 0; return; end
