MATLAB Examples

Compute the Minimum

Compute the minimum of a 3-by-2 matrix input, dsp_examples_u, using the Minimum block.

Open the model.

model = fullfile(matlabroot,'examples','dsp','ex_minimum_ref');
open_system(model)

The Mode parameter of the Minimum block is set to Value and Index. The block processes the input as a two-channel signal with a frame size of three.

Run the model. Display the input and output values.

sim(model)
disp('Data Input')
disp(dsp_examples_u)
disp('Minimum Values')
disp(min_val)
disp('Min Index Array')
disp(min_index)
Data Input
     6     1
     1     3
     3     9
    -7     2
     2     4
     5     1
     8     6
     0     2
    -1     5
    -3     0
     2     4
     1    17

Minimum Values
     1     1
    -7     1
    -1     2
    -3     0
     0     0
     0     0

Min Index Array
     2     1
     1     3
     3     2
     1     1
     1     1
     1     1

In the Value and Index mode, the block outputs:

  • The minimum value over each frame of data along the channel.
  • The index of the minimum value in the respective frame.

Close the model.

close_system(model)