How to generate multiple entities randomly and control the probability of event occurring?

조회 수: 2 (최근 30일)
I am trying to create a model in which 4 different entities are generated randomly. Once the entity is generated, then I want to be able to control the probability that the generated event occurs. Is something like this possible, how can it be done?

답변 (1개)

Will Nitsch
Will Nitsch 2017년 7월 27일
Could you possibly use random number generation ('rand')? Say something has a 25% probability of event 'X' happening, 35% for 'Y' and 40% for 'Z'. You could say:
val = rand;
if(val<=.25) % 25% chance
% event X
else if(val>.25 & val <=.6) % .6-.25 = .35 for the 35%
% event Y
else if(val>.6) % 40% chance
% event Z
end
end
end
  댓글 수: 1
Sebastian Stankiewicz
Sebastian Stankiewicz 2017년 7월 28일
Would I enter this into the entity block for the Matlab function? Would it be in entity generation or event actions? Also, how do you generate a graph for when utilization of resources using blocks from version 5.2. Thanks!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by