Simulink switch that is based on probability

How do you use Simulink to create a pathway with a switch that splits into two based on probability (for eg, 0.4 of the time goes through port A and 0.6 of the time goes through port B)?

1 件のコメント

Renato SL
Renato SL 2019 年 9 月 13 日
Are you using Simevents?
If yes, this discussion might help.

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

 採用された回答

Jim Riggs
Jim Riggs 2019 年 9 月 13 日
編集済み: Jim Riggs 2019 年 9 月 13 日

0 投票

This seems to work for me (The uniform random number is set to a range of 0 to 1):

2 件のコメント

George Jacob
George Jacob 2019 年 9 月 14 日
Thanks so much! Looking forward to trying it but this was exactly along the lines of what I was thinking. I’m trying to create a Markov chain model similar to what is possible with TreeAge Pro
Jim Riggs
Jim Riggs 2019 年 9 月 14 日
編集済み: Jim Riggs 2019 年 9 月 14 日
I'm thinking that one way to implement this in a subsystem like this:
Matlab Answers 20190913a.JPG
In this case, the enabled subsystems simply pass the signal straignt through. Signals A and B are defined outside, and the subsystem simply acts a a probabilistic switch between A and B.
You can create a mask for the subsystem and set the percentage threshold (i.e. the 0.4 value) in the mask.

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

その他の回答 (1 件)

George Jacob
George Jacob 2019 年 9 月 16 日

0 投票

Thanks again! This was very helpful !!

4 件のコメント

Jim Riggs
Jim Riggs 2019 年 9 月 16 日
If my answer was helpful, please accept it.Thanks.
Jim Riggs
Jim Riggs 2019 年 9 月 17 日
Um, you accepted your own answer, not mine.
George Jacob
George Jacob 2019 年 9 月 17 日
Sorry about that. I’m a nube. Hopefully I did it right this time.
Jim Riggs
Jim Riggs 2019 年 9 月 17 日
Thank you.
For future reference, you should not post an answer to your own question, unless you are offering a solution that no one else has offered and that best fits the question. Put your comments in the comment section.
Also, feel free to "vote" for answers that are helpful/interesting to indicate that they have value.(you can vote for as many answers as you like)

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

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

タグ

質問済み:

2019 年 9 月 12 日

コメント済み:

2019 年 9 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by