[scilab-Users] Linear Regression in Scilab
Perrichon Pierre
perrichon.pierre at wanadoo.fr
Thu Oct 27 19:27:13 CEST 2011
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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RegressionLineaire.sce
Type: application/octet-stream
Size: 666 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20111027/75eadde8/attachment.obj>
More information about the users
mailing list