.. highlightlang:: us .. index:: smooth .. index:: Glätten .. index:: moving_average .. _moving_average: moving_average ============== .. us.tag moving_average GERMAN Interpolation New520 Die Funktion :ref:`moving_average` berechnet einen gleitenden Mittelwert für das gegebene Signal. Die Funktion kann zum Glätten eines Signals verwendet werden. .. function:: rvMean = moving_average(rvY, nNeighbor) .. us.return **Returnwert** *rvMean* ist das geglättete Signal. Das Signal hat die gleiche Länge wie *rvY*. Am Anfang und Ende des Signals werden entsprechend weniger Datenpunkte bei der Mittelwertbildung berücksichtigt. .. us.params **Parameter** .. uparam:: rvY *rvY* ist das zu glättende Signal. .. uparam:: nNeighbor *nNeighbor* ist die halbe Fensterbreite. Die gesamte Fensterbreite ist ``nNeighbor * 2 + 1``. .. us.example **Beispiel** :: x = linspace(0, 2*PI, 1000) y = sin(x) + rand(1, 1000) * 0.1 yy = moving_average(y, 10); h = plot(x, y); XYSetProps(h[3], "curve_color = 'blue'"); h = plot(x, yy, h[2]); XYSetProps(h[3], "curve_color = 'red'"); :: * moving_average([1,2,3,4,5,6], 1) 1.5000 2.0000 3.0000 4.0000 5.0000 5.5000 .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Beschreibung * - 5.2.0 - Neu. .. seealso:: :ref:`uberblick-mathematik`, :ref:`moving_median`, :ref:`fspline`, :ref:`pspline`, :ref:`akimaspline`, :ref:`sgolayfilt` :sub:`id-1189333`