다음: , 상위 문서: Polynomial Manipulations   [차례][찾아보기]


28.1 Evaluating Polynomials

The value of a polynomial represented by the vector c can be evaluated at the point 가로 very easily, as the following example shows:

N = length (c) - 1;
val = dot (x.^(N:-1:0), c);

While the above example shows how easy it is to compute the value of a polynomial, it isn’t the most stable algorithm. With larger polynomials you should use more elegant algorithms, such as Horner’s Method, which is exactly what the Octave function polyval does.

In the case where 가로 is a square matrix, the polynomial given by c is still well-defined. As when 가로 is a scalar the obvious implementation is easily expressed in Octave, but also in this case more elegant algorithms perform better. The polyvalm function provides such an algorithm.

세로 = polyval (p, 가로)
세로 = polyval (p, 가로, [], mu)
[세로, dy] = polyval (p, 가로, s)
[세로, dy] = polyval (p, 가로, s, mu)

Evaluate the polynomial p at the specified values of 가로.

If 가로 is a vector or matrix, the polynomial is evaluated for each of the elements of 가로.

When mu is present, evaluate the polynomial for (가로-mu(1))/mu(2).

In addition to evaluating the polynomial, the second output represents the prediction interval, 세로 +/- dy, which contains at least 50% of the future predictions. To calculate the prediction interval, the structured variable s, originating from polyfit, must be supplied.

같이 보기: polyvalm, polyaffine, polyfit, roots, poly.

polyvalm (c, 가로)

Evaluate a polynomial in the matrix sense.

polyvalm (c, 가로) will evaluate the polynomial in the matrix sense, i.e., matrix multiplication is used instead of element by element multiplication as used in polyval.

The argument 가로 must be a square matrix.

같이 보기: polyval, roots, poly.


다음: , 상위 문서: Polynomial Manipulations   [차례][찾아보기]