Funzioni MATLAB:  poly,  polyval , polyfit



» help poly

POLY Convert roots to polynomial.

POLY(V), when V is a vector, is a vector whose elements are the coefficients of the  polynomial whose roots are the elements of V . …………..…….

See also ROOTS, CONV, RESIDUE, POLYVAL.


» help polyval

POLYVAL Evaluate polynomial.

Y = POLYVAL(P,X), when P is a vector of length N+1 whose elements are the coefficients of a polynomial, is the value of the polynomial evaluated at X.

Y = P(1)*X^N + P(2)*X^(N-1) + ... + P(N)*X + P(N+1)

…………..   See also POLYFIT


» help polyfit

POLYFIT Fit polynomial to data.

POLYFIT(X,Y,N) finds the coefficients of a polynomial P(X) of degree N that fits the data, P(X(I))~=Y(I), in a least-squares sense. ……………….

See also POLY, POLYVAL, ROOTS.


ESEMPI :

» poly ( [1   -1] )

                       ans =     1     0    -1

»  x = linspace(0,2,11) ;

»  y = x .^ 2 ;

» coef1 = polyfit (x, y, 1)

coef1 =      2.0000   -0.6000

» coef2 = polyfit (x, y, 2)

coef2 =      1.0000    0.0000    0.0000

» polyval(coef1, x) - y

ans =     -0.6000   -0.2400    0.0400    0.2400    0.3600    0.4000    0.3600

               0.2400    0.0400   -0.2400   -0.6000

» (polyval(coef2,x)) - y

ans =    1.0e-015 *     0.8458    0.6453    0.4718    0.4441    0.4441    0.4441    0.6661     0.6661    0.8882    0.8882    0.8882


Alba C. Simoncelli - MATLAB (nov. 2002) - pag.19                              Indice    Pag. Prec.    Pag. Prec.