Main Content
Compute the Maximum
Compute the maximum of a 3-by-2 matrix input, dsp_examples_u
, using the Maximum block.
Open the model.
model = 'ex_maximum_ref';
open_system(model)
The Mode parameter of the Maximum 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.
sim(model)
Display the input and output values.
disp('Data Input') disp(dsp_examples_u) disp('Maximum Values') disp(max_val) disp('Max Index Array') disp(max_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 Maximum Values 6 9 5 4 8 6 2 17 0 0 0 0 Max Index Array 1 3 3 2 1 1 2 3 1 1 1 1
In the Value and Index
mode, the block outputs:
The maximum value over each frame of data along the channel.
The index of the maximum value in the respective frame.
Close the model.
close_system(model)