How can I make that using MATLAB

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 10 月 10 日
編集済み: Walter Roberson 2021 年 10 月 10 日

0 投票

Probability for discrete events is number of elements (events) that a condition holds for, times the probability of the event, divided by total weight. Total weight of that matrix is 1.
For example, the entire first row is associated with X = 1, and 1 <= 1 1/2, so take the weights of the first row, 1/12 + 1/16 + 1/12 = 1/6 . None of the entries in the second or third row matches, so nothing is added for those rows. Total probability is (1/6) divided by (1) where the (1) is the total weight for the matrix.

2 件のコメント

Fayez Aljuaid
Fayez Aljuaid 2021 年 10 月 10 日
Thank you , I know, but how can i do it by code ?
Walter Roberson
Walter Roberson 2021 年 10 月 10 日
Hint:
[A, B] = ndgrid(4:7, 3:8)
A = 4×6
4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7
B = 4×6
3 4 5 6 7 8 3 4 5 6 7 8 3 4 5 6 7 8 3 4 5 6 7 8
mask = A == 4 & B >= 6
mask = 4×6 logical array
0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

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

カテゴリ

タグ

質問済み:

2021 年 10 月 10 日

コメント済み:

2021 年 10 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by