%%%
% error of polynomial regression
% symbolic toolbox must be available
%%%
x = sym('x','real');	% defintion of the symbolic variable

% symbolic polynomial of order 3
polydim = 3;
j = 0;
for i=polydim:-1:0,
   j=j+1;
   xvec3(j)=x^i;
end
% symbolic polynomial of order 10
polydim = 10;
j = 0;
for i=polydim:-1:0,
   j=j+1;
   xvec10(j)=x^i;
end

%%%
% Estimation of regression errors
%%%
Errfce3 = (sin(x)-sum(p3.*xvec3))^2;
Err3	= sqrt(1/(2*pi)*eval(int(Errfce3,0,2*pi)))
Errfce10 = (sin(x)-sum(p10.*xvec10))^2;
Err10	= sqrt(1/(2*pi)*eval(int(Errfce10,0,2*pi)))
