メインコンテンツ

最大値の計算

Maximumブロックを使用して、3 行 2 列の行列入力 dsp_examples_u の最大値を計算します。

モデルを開きます。

model = 'ex_maximum_ref';
open_system(model)

Maximum ブロックの [モード] パラメーターは、Value and Index に設定されています。ブロックは入力をフレーム サイズが 3 の 2 チャネル信号として処理します。

モデルを実行します。

sim(model)

入力値と出力値を表示します。

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

Value and Index モードでは、ブロックは次を出力します。

  • チャネルに沿った各データ フレームの最大値。

  • それぞれのフレーム内の最大値のインデックス。

モデルを閉じます。

close_system(model)

参考

ブロック