function monomial_approximate_humps ( d )

%*****************************************************************************80
%
%% monomial_approximate_humps uses monomials to approximate humps().
%
  c = monomial_approximate ( @(x)humps(x), d );

  x = linspace ( -1.0, +1.0, 101 );
  y = polyval ( c(end:-1:1), x );
  clf ( );
  hold ( 'on' );
  plot ( x, humps(x), 'g-', 'linewidth', 5  );
  plot ( x, y, 'k-', 'linewidth', 2 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- X --->' );
  ylabel ( '<-- Y(X) --->' );
  label = sprintf ( 'Monomial approximant to humps using degree %d', d );
  title ( label );

  filename = 'monomial_approximate_humps.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

