Moving Minimum
R2026bMoving minimum
Moving Minimum block
To add a block to a model, double-click the canvas and start typing the block name. Then, select the block from the list.
Libraries:
DSP System Toolbox /
Statistics
Description
The Moving Minimum block determines the moving minimum of the input signal along each channel independently over time. The block uses the sliding window method to determine the moving minimum. In this method, a window of specified length moves over each channel sample by sample, and the block determines the minimum over the data in the window.
You can change the window length during simulation by selecting the Make window length tunable parameter. Specify the tunable window length from the block dialog box by updating the Window length parameter. Alternatively, specify it through the input port WL by selecting the Specify window length from input port parameter. For more details, see Algorithms. (since R2026b)
Ports
Input
Data over which the block determines the moving minimum using the sliding window method. The block accepts real-valued or complex-valued multichannel inputs, that is, m-by-n size inputs, where m ≥ 1 and n ≥ 1. The block also accepts variable-size inputs. During simulation, you can change the size of each input channel. However, the number of channels cannot change.
This port is unnamed until you enable the WL input port.
Data Types: single | double
Complex Number Support: Yes
Since R2026b
Specify the tunable window length as a positive integer. The block uses this value as the sliding window length for computing the moving minimum.
When you select Auto-adjust invalid window length, the block adjusts invalid window length values from the input port and issues a warning. For more information on what values are invalid, see the Auto-adjust invalid window length parameter description.
When you clear the Auto-adjust invalid window length parameter, the block throws an error for invalid window length values.
Dependencies
To enable this port, select Specify window length, Make window length tunable, and Specify window length from input port.
Data Types: single | double
Output
Moving minimum output, determined using the sliding window method. The size of the output matches the size of the input. The window slides column-wise along each channel, and the block determines the minimum of the data in the window. For more details, see Algorithms.
Data Types: single | double
Complex Number Support: Yes
Parameters
Select this parameter to specify a finite window length. When you clear this parameter, the length of the sliding window is infinite. In this mode, the block determines the minimum of the current sample and all the previous samples in the channel.
Since R2026b
Select this parameter to make the window length tunable, that is, you can change the window length during simulation through the block dialog box by updating the Window length parameter or through the input port WL by selecting the Specify window length from input port parameter.
When you clear this parameter, the window length is fixed and you cannot change it during simulation. Specify the window length through the Window length parameter.
Dependencies
To enable this parameter, select Specify window length.
Since R2026b
When you select this parameter, the block reads the tunable window length from the input port, WL. When you clear this parameter, the block reads the tunable window length from the Window length parameter.
Dependencies
To enable this parameter, select Specify window length and Make window length tunable.
Specify the length of the sliding window in samples as a positive integer.
When you select the Make window length tunable parameter, the window length you specify is tunable and must be less than or equal to the value you specify in the Maximum window length parameter. When you clear the Make window length tunable parameter, the window length is fixed. (since R2026b)
Dependencies
To enable this parameter, select Specify window length. In addition, if you select Make window length tunable, you must clear the Specify window length from input port parameter.
Since R2026b
Specify the maximum value of the tunable window length as a positive integer. The window length you specify during simulation cannot exceed this value.
Dependencies
To enable this parameter, select Specify window length and Make window length tunable.
Since R2026b
When you select this parameter, the block adjusts invalid window length values from the input port and issues a warning.
If the tunable window length value is greater than Maximum window length, the block uses Maximum window length.
If the tunable window length value is less than 1, the block uses 1.
If the tunable window length value is not an integer, the block uses the floored value.
When you clear this parameter, the block throws an error for invalid window length values.
Dependencies
To enable this parameter, select Specify window length, Make window length tunable, and Specify window length from input port.
Specify the type of simulation to run. You can set this parameter to:
Interpreted execution— Simulate model using the MATLAB® interpreter. This option shortens startup time.Code generation— Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations as long as the model does not change. This option requires additional startup time but provides faster subsequent simulations.
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Algorithms
In the sliding window method, the output for each input sample is the minimum of the current sample and the Len−1 previous samples. Len is the length of the window in samples. When the algorithm computes the first Len−1 outputs, the length of the window is the length of the data that is available.
When you do not specify the window length, the algorithm chooses an infinite window length. In this mode, the output is the minimum of the current sample and all the previous samples in the channel.
Consider an example of computing the moving minimum of a streaming input data using the sliding window method. The algorithm uses a window length of 4. With each input sample that comes in, the window of length 4 moves along the data.
![Sliding window method for moving minimum with window length 4 and input samples [−1, −2, 3, 2, 5, 2]. At each time step n=0 through n=5, the window expands until length 4 is reached, then moves along the data. Moving minimum computes min for each window position, producing values −1, −2, −2, −2, −2, 2 at n=5](movmin_slidewin.png)
When you specify the window length to be tunable, the moving minimum algorithm maintains an internal buffer of size MaxWL−1 to store past input samples, where MaxWL is the maximum window length. At each time step, the moving minimum algorithm performs these operations:
Concatenates the buffer with the current input to form an extended data sequence.
Extracts the most recent window length samples from the extended data sequence.
Computes the moving minimum over the extracted samples using a sliding window and discards the endpoints.
Stores the most recent MaxWL−1 samples in the buffer for the next time step.
This approach allows you to change the window length at each time step while the algorithm maintains continuity of the output signal.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2016bYou can now change the window length during simulation by selecting the Make window length tunable parameter. Specify the tunable window length from the block dialog box by updating the Window length parameter or through the WL input port by selecting the Specify window length from input port parameter. The Maximum window length parameter sets the upper bound for the tunable window length. Select Auto-adjust invalid window length to control whether invalid window length values are automatically adjusted with a warning or cause an error.
The default value of the Simulate using parameter is now
Interpreted execution. With this change, the block uses the
MATLAB interpreter for simulation by default.
See Also
Blocks
- Minimum | Moving Maximum | Moving Average | Moving RMS | Moving Standard Deviation | Moving Variance | Median Filter
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)