calculate the minimum probability

2 ビュー (過去 30 日間)
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2022 年 1 月 19 日
回答済み: Steven Lord 2022 年 1 月 19 日
I have in one case two matrices and in the other case three matrices of size 2922x1. the values within the matrices are probability values. how do i calculate the minimum probability between these 2 and between these 3 matrices?
  2 件のコメント
Torsten
Torsten 2022 年 1 月 19 日
What do you mean by "minimum probability between two matrices" ?
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2022 年 1 月 19 日
then let's take the case of the two matrices: these two matrices are constructed in the same way (200x200 double), that is, made up of 200 rows and 200 columns. I have to create a third matrix characterized by the minimum value between the two on all rows and all columns.
case of the three matrices: there are three matrices with 200 rows and 200 columns, I have to create a fourth matrix that fourth matrix characterized by the minimum value among the three on all rows and all columns.
considering the image:
a3 is the minimum (lowest) value between a1 and a2,
b3 is the minimum value between b1 and b2
and so on
hope to be better explained now .. let me know thanks

サインインしてコメントする。

採用された回答

Jon
Jon 2022 年 1 月 19 日
Say you have three matrices of the same size A,B,C then you can find the minimum as you describe using
D = min(min(A,B),C)

その他の回答 (1 件)

Steven Lord
Steven Lord 2022 年 1 月 19 日
Assuming they are the same class and size, you can concatenate them and call min with a dimension input.
A = randi([-5, 5], 4)
A = 4×4
-2 0 3 -1 -1 0 4 5 3 -1 5 -2 0 -3 4 1
B = randi([-5, 5], 4)
B = 4×4
-3 2 -3 1 -4 3 3 -1 -1 5 5 -5 -2 1 2 -1
C = cat(3, A, B)
C =
C(:,:,1) = -2 0 3 -1 -1 0 4 5 3 -1 5 -2 0 -3 4 1 C(:,:,2) = -3 2 -3 1 -4 3 3 -1 -1 5 5 -5 -2 1 2 -1
D1 = min(C, [], 3) % Min along the third dimension
D1 = 4×4
-3 0 -3 -1 -4 0 3 -1 -1 -1 5 -5 -2 -3 2 -1
The concatenation strategy can work with more than two arrays, but for this simple example of two arrays you can just call the binary form of min.
D2 = min(A, B)
D2 = 4×4
-3 0 -3 -1 -4 0 3 -1 -1 -1 5 -5 -2 -3 2 -1

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by