Effacer les filtres
Effacer les filtres

Monte Carlo type of simulation in Simulink using USS block?

1 vue (au cours des 30 derniers jours)
Michelle
Michelle le 10 Juil 2012
Here are the basics - I've got a model with a computed distance between 2 objects. The likelihood that object A will detect object B is a probability dependent on distance (and its a cumulative lognormal curve).
I want to include a probability function based on that computed distance. So that at X meters, the probability of detection is 20%. At Y distance its 50% etc. At each step of the model, the distance will be different, so it needs to redo its random draw from the probability function and output whether or not object B was detected.
I was under the impression that the uncertain state block within the robust control toolbox was the direction to go, but so far I haven't been able to decipher the "help" information to learn how to use and apply it. (And as far as I can understand, it would be ideal b/c I can also run the model varying all the uncertain variables a certain number of times from the command line).
HELP PLEASE!!!
  4 commentaires
Ryan G
Ryan G le 12 Juil 2012
If your model is not state space already I would recommend not going that route. There is a demo showing how to do monte carlo with USS but there are many ways to do it without a state space.
If you can post a screenshot of roughly what you're modeling I can make some recommendations. You can use a service like imgur.com or whatever works for you.
Michelle
Michelle le 13 Juil 2012
At the moment, this section is a blank slate (well, blank subsystem actually). I've got computed distance (recalculated at each step) incoming, and outgoing I'd like to have a 1 (detection) or 0 (no detection) to trip a switch for an indicator. The middle part is blank b/c i had wrongly assumed that the USS block would be a simple way to do a probability draw!

Connectez-vous pour commenter.

Réponses (1)

Ryan G
Ryan G le 13 Juil 2012
Modifié(e) : Ryan G le 13 Août 2012
There are Uniform and Normal Random Number blocks in Simulink you can use to create a random draw (assuming you want this to change with each step). You can setup a comparison for random detection (1's and 0's) like this in simulink:
Unfiform Random Number block with minimum set to 0 -> Quantizer with interval set to one
This will output 1's and 0's with 50% chance of either.
To achieve a 20% detection rate you could do copy what's above, set the max of uniform random number to 4 and after the quantizer use a compare to zero block setup as ==0
Since the odds of a zero out of the quantizer should be 1/5 the output of the compare to zero should be true 20% of the time. You can repeat a similar process for any % you want.
  2 commentaires
Michelle
Michelle le 13 Juil 2012
But how do I make the 50% vs 20% etc based on the input distance?
Ryan G
Ryan G le 13 Juil 2012
In the library under Signal Library there is a multiport switch, which is essentially a selector. The first input to the switch would be the distance selection, ie if distance == 1 choose 1 if distance == 2 choose to, the rest of the inputs would correspond to the random values as described above.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by