[scilab-Users] Linear Regression in Scilab

Calixte Denizet calixte.denizet at scilab.org
Thu Oct 27 18:21:48 CEST 2011


Hi Samuel,

If x and y are the column vectors corresponding to the coordinates of 
your points, you can build the Vandermonde matrix on x and use lsq 
operator \:

n=length(x);
v=ones(n,deg+1) // deg is the degree of your polynomial
for i=2:deg+1
   v(:,i)=x.*v(:,i-1)
end
P=poly((v\y)', "x", "coeff");

You can now plot P: plot(0:0.1:10,horner(P,0:0.1:10)).

Best regards

Calixte

On 27/10/2011 17:21, Samuel Enibe wrote:
> Dear Sir,
>
> Which function can one use in SCILAB for polynomial regression using 
> LEAST SQUARES.
> In MATLAB, this is done with the POLYFIT
>
> Samuel Enibe
>




More information about the users mailing list