.. highlightlang:: us .. index:: polyfit .. _polyfit: polyfit ======= .. us.tag polyfit NOTREADYGERMAN Interpolation New5502 :ref:`polyfit` findet die Koeffizienten eines Polynoms des Grads *N*. .. function:: p = polyfit(x, y, N) .. us.return **Returnwert** *p* ist ein Vektor mit *N* + 1 Polynom-Koeffizienten in absteigender Ordnung: :math:`P(x) = p_1x^n + p_2x^{n-1}+ \dotsb + p_{n}x + p_{n+1}` .. us.params **Parameter** .. uparam:: x *x* ist ein Vektor mit x-Koordinaten. .. uparam:: y *y* ist ein Vektor mit y-Koordinaten. Gleiche Länge wie *x*. .. uparam:: N *N* ist der Grad des Polynoms. *N* >= 0 und *N* <= len(x)-1. .. us.example **Beispiel** :: def test_polyfit() { x = 0:0.1:3; y = erf(x); print p = polyfit(x, y, 3); h1 = plot(x, y) y2 = polyval(p, x); h2 = plot(x, y2, h1[2]) XYSetProps(h2[3], "curve-color='red'"); } test_polyfit() .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Beschreibung * - R2013.2 - Dokumentiert. .. seealso:: :ref:`overview-mathematic`, :ref:`polyval` :sub:`id-204970`