lets say I have two matrices, of a different size:
a = zeros(1,100);
b = ones(1,200);
now I want to combine them together. The trick is, that I want to mix them randomly, but with defined how to call it.. hmm, lifetime of each group, with normal distribution.
so instead of having random 010010101010001010..
I want to set this ‘lifetime’ parameter to f.ex. 4, and as a result have something like
00001111000111110000000011110000
In other words, I have to divide it into groups of zeros and ones. Average size of single group of ones will be 4 (but there will be also groups with 2, 3 or 7, you know what I mean). Any ideas?
Thanks
There is no neat way of doing this, you are going to have to create a method of doing it.
I would look at the Poisson function for your choice of mixing the two together, although if you do it with the different sized arrays, you’re going to have some weird stuff at the end.
Basically, I would do something like this. Note that this code probably won’t work, but it should give you a starting place at least. I’ll also let you figure out how to combine them when you have exceeded the length of the matrix.