mardi 13 juin 2017

Randomly choose elements from a matrix under some conditions in matlab

I have a time varying 16*1 vector and I want to randomly pick 11 elements from this vector at each time instant. But I want that the picked elements between consecutive times be as different as possible. For example, if elements 1:11 are chosen at time t, I want the elements 12:16 surely be among chosen elements at time instant t+1. And in t+2 ,again, the most different elements from t+1 should be chosen and this goes on to the end of my time duration t=96. I myself did this:

M=11;
N=16;
for t=1:T
 E = eye(M,N);
 Phi(:,:,t)=E(randperm(M),randperm(N));
end

and multiplied Phi(:,:,t) to my 16*1 vector at time instant t (x(t)).

But this is completely random and does not consider variety of selection between to consecutive time instants. I appreciate any help.




Aucun commentaire:

Enregistrer un commentaire