Simulink switch that is based on probability
1 次查看(过去 30 天)
显示 更早的评论
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)?
采纳的回答
Jim Riggs
2019-9-13
编辑:Jim Riggs
2019-9-13
This seems to work for me (The uniform random number is set to a range of 0 to 1):
2 个评论
Jim Riggs
2019-9-14
编辑:Jim Riggs
2019-9-14
I'm thinking that one way to implement this in a subsystem like this:
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
2019-9-16
4 个评论
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)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subsystems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!