polyval
evaluates the polynomial for given values
Syntax
y = polyval(p, x) y = polyval(p, x, [], mu) [y, d] = polyval(p, x, S) [y, d] = polyval(p, x, S, mu)
Arguments
- p
- vector of doubles or polynom, the polynomial coefficients 
- x
- real or complex vector/matrix 
- S
- a structure (second output of polyfit) containing the following fields: - R
- a matrix of doubles, the triangular factor R form the qr decomposition 
- df
- a real, the degrees of freedom 
- normr
- a real, the norm of the residuals 
 
- mu
- a - 1x- 2vector (third output of polyfit).- mu(1)is- mean(x)and- mu(2)is- stdev(x)
- y
- a real or complex vector/matrix, the result of the polynomial evaluated at - x
- d
- a vector of the same size as - x, the standard error for prediction
Description
y = polyval(p, x) evaluates the polynomial p at each value of x. 
            p can be a vector containing the coefficients of the polynomial (output of
            polyfit function) or a polynom.
The structure S, the second output argument of polyfit function, is used to compute d, 
            standard error for prediction.
y = polyval(p, x, [], mu) or [y, d] = polyval(p, x, S, mu) 
            evaluates the polynomial p at each centered and scaled points: (x - mu(1))/mu(2). mu is the third output argument 
            of polyfit function.
Examples
x = 0:5; // polynom: p(x) = 3x^2+2x+1 p = [3, 2, 1] y = polyval(p, x); p = poly(1:3, 'x', 'coeff'); y2 = polyval(p, x); y == y2
History
| Version | Description | 
| 2025.0.0 | Introduction in Scilab. | 
| Report an issue | ||
| << polyfit | Statistics | Sparse Matrix >> |