Borrar filtros
Borrar filtros

How to identify same pattern with phase difference among rows?

1 visualización (últimos 30 días)
Iro
Iro el 15 de Mayo de 2015
Editada: Iro el 18 de Mayo de 2015
Hi all!
I have constructed a matrix (254864x6) with the following logic: Create all possible combinations of six integers (representing time intervals) between 5 and 20 that sum up to 60. This actually represents the time interval between two consecutive discrete events (6 such events in total) that have a repetition period T=1hour.
I know that this matrix has "double rows" in the sense that the same pattern repeats (if the observation period is e.g. 6h) but with some phase difference. For example, the rows:
5 5 20 20 5 5
and
5 5 5 5 20 20
or
10 10 15 15 5 5
and
15 15 5 5 10 10
My question is, how can I identify these rows, in a robust way, so I can save some memory and calculation time (by discarding them) in what I am doing further with this script (which uses this matrix as an input to some other process)?
Thanks,
Iro
  5 comentarios
Walter Roberson
Walter Roberson el 18 de Mayo de 2015
By the way, the reason for going for the largest digits first is that the amount of memory required is determined by the final dimension, so you want the final dimension to be less than the maximum.
Iro
Iro el 18 de Mayo de 2015
Editada: Iro el 18 de Mayo de 2015
Hi Walter, thanks a lot for your reply!
I am a bit confused when it comes to the use of this logical encounter and what is the purpose of comparing its length to idx, which is a vector, according to this implementation:
function find_phase_shift(A) % A has already shifted order
subtract_value=(min(min(A)))-1; % =4
A=A-subtract_value;
sub_ind_value=max(max(A)); %16 (=20-4)
sub_ind_vec=sub_ind_value*ones(1,length(A));
for i=1:size(A,1)
idx = sub2ind(sub_ind_vec, A(i,:)); % idx = sub2ind([16 16 16 16 16 16], TheVector)
% size_idx=1x6...
%...logical encounter?
end
%...
end
Could you be a bit more detailed in that? Or am I getting something wrong here?
Also, I changed the precision to int8 and I still get 16777216 rows of possible combinations but only 254864 when I filter those which sum up to 60...
Thanks again!
Iro

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by