Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - Português


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 1 x 2 vector (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

See also

  • vander — Vandermonde matrix
  • polyfit — Polynomial curve fitting

History

VersãoDescrição
2025.0.0 Introduction in Scilab.
Report an issue
<< polyfit Estatística Matrizes Esparsas >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:16:52 CEST 2024