Clear Filters
Clear Filters

How can I generate controlled sequences in matlab?

1 view (last 30 days)
For example I have numbers 1 to 8.
The 4 occurres more frequently after a 3. However this can be consecutive 3 4 or non consecutive 3 1 5 6 4. I have few more constraints concerning order as the example above. How can I generate sequences taking them to account.
Thanks
  2 Comments
Ced
Ced on 13 Mar 2016
I don't think there is a general answer.
First, in the most general form, if your samples are not iid, i.e. if the distribution changes depending on what has been sampled before, you have to sample the elements sequentially.
Then, the next steps really depend on what you mean by "more frequently".
Let's assume you want a total of N samples. If you have two distributions A and B, i.e. one "before a 3 was sampled" and one "after a 3 was sampled", you could either:
a) Extract N samples from distribution A, look for the first "3", then resample all the following entries using distribution B.
b) Sample them sequentially, starting with distribution A, and after the first "3" has been extracted, change to using distribution B.
This can become arbitrarily complex depending on what the "occurs more frequently" really means, i.e. on how/when your distribution changes.
You might want to have a look at Markov Decision Processes.
John D'Errico
John D'Errico on 13 Mar 2016
Edited: John D'Errico on 13 Mar 2016
You have not specified a clear description of the rules. Merely saying that some event happens more often than other events is not mathematics. It is just a rough suggestion. Then you say you have a few more constraints. Of course, what they are remains only in your mind.
You need to turn your rough guidelines into mathematical goals, or at least provide clear explanations that are sufficient.

Sign in to comment.

Answers (0)

Categories

Find more on Random Number Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!