help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linear Regression


From: Marco Atzeri
Subject: Re: Linear Regression
Date: Sat, 8 Dec 2018 08:14:23 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2

Am 08.12.2018 um 01:06 schrieb LucaLuca:
hi,
i try this example :

function esercizio_interpolazione()

   pkg load statistics

   a=[4 5 6 -1 0 4 -2 0 -3]

   b=[1 2 3 4 5 6 7 8 9]

   yi =polyfit(a',b',1)

Luca,

you should read the documentation with some attention

 -- P = polyfit (X, Y, N)
 -- [P, S] = polyfit (X, Y, N)
 -- [P, S, MU] = polyfit (X, Y, N)
     Return the coefficients of a polynomial P(X) of degree N that
     minimizes the least-squares-error of the fit to the points '[X,
     Y]'.


You are inverting X and Y


 yi =polyfit(b',a',1)
yi =

  -0.90000   5.94444



   hold on
   plot(b',a','b')

   plot(yi,'c')
endfunction

look this pics:

https://gyazo.com/521d0d62cb33d334251e374c27fdce92


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]