<< polystab | FOSSEE_Signal_Processing_Toolbox | postpad >>

FOSSEE_Signal_Processing_Toolbox >> FOSSEE_Signal_Processing_Toolbox > polyval

# polyval

Evaluate a polynomial at specified points.

### Syntax

    y = polyval(p, x)
    [y, delta] = polyval(p, x, S)
    [y, delta] = polyval(p, x, S, mu)

### Parameters

p:

  Coefficients of the polynomial (vector). The coefficients are in descending powers of the polynomial.

x:

  Points at which the polynomial is evaluated (vector or matrix).

S:

  (optional) Structure generated by `polyfit` for error estimation.

mu:

  (optional) Centering and scaling parameters [mean, std] for x.

### Description

The `polyval` function evaluates a polynomial at specified points using its coefficients. It supports error estimation when used with the structure `S` from `polyfit`. If centering and scaling parameters `mu` are provided, the evaluation is performed on scaled values of `x`.

Notes - The function uses Horner's method for efficient polynomial evaluation. - If `S` is provided, `delta` estimates the standard deviation of the error in predicting future observations.

### Examples

    // Evaluate a polynomial at specific points:
    p = [3, 2, 1]
    y = polyval(p, [5, 7, 9])

Report an issue
<< polystab | FOSSEE_Signal_Processing_Toolbox | postpad >>