<?xml version="1.0" encoding="UTF-8"?>

<!--
 *
 * This help file was generated from polyval.sci using help_from_sci().
 *
 -->

<refentry version="5.0-subset Scilab" xml:id="polyval" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:scilab="http://www.scilab.org"
          xmlns:db="http://docbook.org/ns/docbook">

  <refnamediv>
    <refname>polyval</refname>
    <refpurpose>Evaluate a polynomial at specified points.</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Syntax</title>
   <synopsis>
   y = polyval(p, x)
   [y, delta] = polyval(p, x, S)
   [y, delta] = polyval(p, x, S, mu)
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Parameters</title>
   <variablelist>
        <varlistentry>
            <term>p:</term>
            <listitem><para> Coefficients of the polynomial (vector). The coefficients are in descending powers of the polynomial.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>x:</term>
            <listitem><para> Points at which the polynomial is evaluated (vector or matrix).</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>S:</term>
            <listitem><para> (optional) Structure generated by `polyfit` for error estimation.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>mu:</term>
            <listitem><para> (optional) Centering and scaling parameters [mean, std] for x.</para></listitem>
        </varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
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`.
   </para>
   <para>
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.
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
// Evaluate a polynomial at specific points:
p = [3, 2, 1]
y = polyval(p, [5, 7, 9])



   ]]></programlisting>
</refsection>
</refentry>
