movprod
Moving product
Syntax
Description
M = movprod(
returns
an array of local A
,k
)k
-point products, where each
product is calculated over a sliding window of length k
across
neighboring elements of A
. M
is
the same size as A
.
When k
is odd, the window is centered about
the element in the current position. When k
is
even, the window is centered about the current and previous elements.
The window size is automatically truncated at the endpoints when there
are not enough elements to fill the window. When the window is truncated,
the product is taken over only the elements that fill the window.
If
A
is a vector, thenmovprod
operates along the length of the vectorA
.If
A
is a multidimensional array, thenmovprod
operates along the first dimension ofA
whose size does not equal 1.
M = movprod(___,
specifies the
dimension of dim
)A
to operate along for any of the previous syntaxes.
For example, if A
is a matrix, then
movprod(A,k,2)
operates across the columns of
A
, computing the k
-element sliding product
for each row.
M = movprod(___,
specifies
whether to include or omit nanflag
)NaN
values from the
calculation for any of the previous syntaxes. movprod(A,k,'includenan')
includes
all NaN
values in the calculation, which is the
default. movprod(A,k,'omitnan')
ignores them and
computes the product over fewer points.
M = movprod(___,
specifies
additional parameters for the moving product using one or more name-value
pair arguments. For example, if Name,Value
)x
is a vector of
time values, then movprod(A,k,'SamplePoints',x)
computes
the moving product relative to the times in x
.
Examples
Input Arguments
Extended Capabilities
Version History
Introduced in R2017a