annotate scripts/statistics/movmean.m @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 81d26e8481a6
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30329
diff changeset
3 ## Copyright (C) 2018-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27567
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
26262
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
7 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
8 ## This file is part of Octave.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
9 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
13 ## (at your option) any later version.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
14 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
18 ## GNU General Public License for more details.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
19 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
26262
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
25
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
26 ## -*- texinfo -*-
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
27 ## @deftypefn {} {@var{y} =} movmean (@var{x}, @var{wlen})
28025
9d9e01986105 doc: Fix typo in movXXX function prototype (bug #57688).
Rik <rik@octave.org>
parents: 27923
diff changeset
28 ## @deftypefnx {} {@var{y} =} movmean (@var{x}, [@var{nb}, @var{na}])
26262
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
29 ## @deftypefnx {} {@var{y} =} movmean (@dots{}, @var{dim})
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
30 ## @deftypefnx {} {@var{y} =} movmean (@dots{}, "@var{nancond}")
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
31 ## @deftypefnx {} {@var{y} =} movmean (@dots{}, @var{property}, @var{value})
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
32 ## Calculate the moving average over a sliding window of length @var{wlen} on
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
33 ## data @var{x}.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
34 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
35 ## If @var{wlen} is a scalar, the function @code{mean} is applied to a
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
36 ## moving window of length @var{wlen}. When @var{wlen} is an odd number the
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
37 ## window is symmetric and includes @w{@code{(@var{wlen} - 1) / 2}} elements on
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
38 ## either side of the central element. For example, when calculating the
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
39 ## output at index 5 with a window length of 3, @code{movmean} uses data
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
40 ## elements @w{@code{[4, 5, 6]}}. If @var{wlen} is an even number, the window
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
41 ## is asymmetric and has @w{@code{@var{wlen}/2}} elements to the left of the
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
42 ## central element and @w{@code{@var{wlen}/2 - 1}} elements to the right of the
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
43 ## central element. For example, when calculating the output at index 5 with a
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
44 ## window length of 4, @code{movmean} uses data elements
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
45 ## @w{@code{[3, 4, 5, 6]}}.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
46 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
47 ## If @var{wlen} is an array with two elements @w{@code{[@var{nb}, @var{na}]}},
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
48 ## the function is applied to a moving window @code{-@var{nb}:@var{na}}. This
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
49 ## window includes @var{nb} number of elements @emph{before} the current
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
50 ## element and @var{na} number of elements @emph{after} the current element.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
51 ## The current element is always included. For example, given
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
52 ## @w{@code{@var{wlen} = [3, 0]}}, the data used to calculate index 5 is
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
53 ## @w{@code{[2, 3, 4, 5]}}.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
54 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
55 ## If the optional argument @var{dim} is given, operate along this dimension.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
56 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
57 ## The optional string argument @qcode{"@var{nancond}"} controls whether
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
58 ## @code{NaN} and @code{NA} values should be included (@qcode{"includenan"}),
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
59 ## or excluded (@qcode{"omitnan"}), from the data passed to @code{mean}. The
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
60 ## default is @qcode{"includenan"}. Caution: the @qcode{"omitnan"} option is
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
61 ## not yet implemented.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
62 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
63 ## The calculation can be controlled by specifying @var{property}/@var{value}
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
64 ## pairs. Valid properties are
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
65 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
66 ## @table @asis
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
67 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
68 ## @item @qcode{"Endpoints"}
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
69 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
70 ## This property controls how results are calculated at the boundaries
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
71 ## (@w{endpoints}) of the window. Possible values are:
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
72 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
73 ## @table @asis
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
74 ## @item @qcode{"shrink"} (default)
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
75 ## The window is truncated at the beginning and end of the array to exclude
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
76 ## elements for which there is no source data. For example, with a window of
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
77 ## length 3, @code{@var{y}(1) = mean (@var{x}(1:2))}, and
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
78 ## @code{@var{y}(end) = mean (@var{x}(end-1:end))}.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
79 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
80 ## @item @qcode{"discard"}
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
81 ## Any @var{y} values that use a window extending beyond the original
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
82 ## data array are deleted. For example, with a 10-element data vector and a
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
83 ## window of length 3, the output will contain only 8 elements. The first
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
84 ## element would require calculating the function over indices
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
85 ## @w{@code{[0, 1, 2]}} and is therefore discarded. The last element would
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
86 ## require calculating the function over indices @w{@code{[9, 10, 11]}} and is
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
87 ## therefore discarded.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
88 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
89 ## @item @qcode{"fill"}
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
90 ## Any window elements outside the data array are replaced by @code{NaN}. For
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
91 ## example, with a window of length 3,
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
92 ## @code{@var{y}(1) = mean ([NaN, @var{x}(1:2)])}, and
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
93 ## @code{@var{y}(end) = mean ([@var{x}(end-1:end), NaN])}.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
94 ## This option usually results in @var{y} having @code{NaN} values at the
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
95 ## boundaries, although it is influenced by how @code{mean} handles @code{NaN},
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
96 ## and also by the property @qcode{"nancond"}.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
97 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
98 ## @item @var{user_value}
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
99 ## Any window elements outside the data array are replaced by the specified
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
100 ## value @var{user_value} which must be a numeric scalar. For example, with a
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
101 ## window of length 3,
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
102 ## @code{@var{y}(1) = mean ([@var{user_value}, @var{x}(1:2)])}, and
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
103 ## @code{@var{y}(end) = mean ([@var{x}(end-1:end), @var{user_value}])}.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
104 ## A common choice for @var{user_value} is 0.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
105 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
106 ## @item @qcode{"same"}
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
107 ## Any window elements outside the data array are replaced by the value of
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
108 ## @var{x} at the boundary. For example, with a window of length 3,
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
109 ## @code{@var{y}(1) = mean ([@var{x}(1), @var{x}(1:2)])}, and
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
110 ## @code{@var{y}(end) = mean ([@var{x}(end-1:end), @var{x}(end)])}.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
111 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
112 ## @item @qcode{"periodic"}
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
113 ## The window is wrapped so that any missing data elements are taken from
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
114 ## the other side of the data. For example, with a window of length 3,
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
115 ## @code{@var{y}(1) = mean ([@var{x}(end), @var{x}(1:2)])}, and
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
116 ## @code{@var{y}(end) = mean ([@var{x}(end-1:end), @var{x}(1)])}.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
117 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
118 ## @end table
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
119 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
120 ## @item @qcode{"SamplePoints"}
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
121 ## Caution: This option is not yet implemented.
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
122 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
123 ## @end table
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
124 ##
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
125 ## Programming Note: This function is a wrapper which calls @code{movfun}.
28959
5394d688d456 doc: Use @code{} within alternate text for @xref,@pxref macros for better Info display.
Rik <rik@octave.org>
parents: 28942
diff changeset
126 ## For additional options and documentation, @pxref{XREFmovfun,,@code{movfun}}.
26262
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
127 ##
30329
81d26e8481a6 maint: Shorten @seealso lines to less than 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29359
diff changeset
128 ## @seealso{movfun, movslice, movmad, movmax, movmedian, movmin, movprod,
81d26e8481a6 maint: Shorten @seealso lines to less than 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29359
diff changeset
129 ## movstd, movsum, movvar}
26262
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
130 ## @end deftypefn
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
131
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
132 function y = movmean (x, wlen, varargin)
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
133
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
134 if (nargin < 2)
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
135 print_usage ();
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
136 endif
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
137
26266
895f2f609a96 movXXX.m: bug #55241. Add simple test
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 26262
diff changeset
138 y = movfun (@mean, x, wlen, __parse_movargs__ ("movmean", varargin{:}){:});
26262
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
139
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
140 endfunction
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
141
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
142
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
143 ## FIXME: Need functional BIST tests
28942
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28896
diff changeset
144 ## test for bug #55241
26266
895f2f609a96 movXXX.m: bug #55241. Add simple test
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 26262
diff changeset
145 %!assert ([1.5; (2:9).'; 9.5], movmean ((1:10).', 3))
26262
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
146
f73ca7468864 Add movXXX moving statistical functions bug #48774).
Rik <rik@octave.org>
parents:
diff changeset
147 ## Test input validation
28896
90fea9cc9caa test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents: 28025
diff changeset
148 %!error <Invalid call> movmean ()
90fea9cc9caa test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents: 28025
diff changeset
149 %!error <Invalid call> movmean (1)