[scilab-Users] Linear Regression in Scilab
samuel.enibe at unn.edu.ng
samuel.enibe at unn.edu.ng
Fri Oct 28 16:20:34 CEST 2011
Thank you so much for the solution.
God bless you
.
Samuel Enibe
Sent from my Nokia phone
-----Original Message-----
From: Perrichon Pierre
Sent: 27/10/2011 6.27.13 pm
Subject: RE: [scilab-Users] Linear Regression in Scilab
Hello,
Is the attached file also solves the question?
-----Message d'origine-----
De : Calixte Denizet [mailto:calixte.denizet at scilab.org]
Envoyé : jeudi 27 octobre 2011 18:22
À : users at lists.scilab.org
Objet : Re: [scilab-Users] Linear Regression in Scilab
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