clear all; close all;
%-------------------- demo_least_square_fh ---------------------------
% This script returns the approximation error of the least square method
% and the vector of coefficients c. The data (x_i,y_i) are choosen
% randomically in [-5,5] x [-10,10].
% 
% Function called: least_square_fh
%
%  ---------------------------------------------------------------
% Authors: 
%      Stefano De Marchi and Cinzia Bandiziol
%      Department of Pure and Applied Math.
%      University of Padova
%           
% Version: May 2015		
%  ----------------------------------------------------------------	

n=11;
d=3;
m=51;

% Random data in [-5,5] x [-10,10]
xi = -5 + (10)*rand(m,1);
yi = -10 + (20)*rand(m,1);
a=min(xi);b=max(xi);

x=linspace(a,b,n)';% equidistant nodes
[Err,c]=least_square_fh(a,b,x,d,xi,yi)