Home > atmlab > randomize > iaaft > init_regular_indices.m

init_regular_indices

PURPOSE ^

This function returns a matrix with indices for use in the SIAAFT

SYNOPSIS ^

function [indices] = init_regular_indices(counter, denom, noValues)

DESCRIPTION ^

 This function returns a matrix with indices for use in the SIAAFT
 algorithm. These indices are to be used with a vector of length noValues.
 The number of indices is noValues*counter/denom, i.e. the fraction is
 counter/denom(inator).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

init_regular_indices.m

SOURCE CODE ^

0001 function [indices] = init_regular_indices(counter, denom, noValues)
0002 % This function returns a matrix with indices for use in the SIAAFT
0003 % algorithm. These indices are to be used with a vector of length noValues.
0004 % The number of indices is noValues*counter/denom, i.e. the fraction is
0005 % counter/denom(inator).
0006 
0007 noRep = ceil(noValues/denom);
0008 lengthIndices = noRep*counter;
0009 indices = zeros(lengthIndices, denom);
0010     
0011 for di = 1:denom
0012     if ( counter+di-1 <= denom )
0013         baseIndices = (di:di+counter-1)';
0014     else
0015         baseIndices1 = di:denom;
0016         baseIndices2 = 1:di+counter-denom-1;
0017         baseIndices  = [baseIndices2 baseIndices1]';
0018     end
0019 
0020     for i=1:noRep
0021         bi = (i-1)*counter+1;
0022         ei = i*counter;
0023         indices(bi:ei, di) = baseIndices + (i-1)*denom;
0024     end
0025     
0026     ei = lengthIndices;
0027     while (indices(ei, di) > noValues )
0028         indices(ei, di) = indices(1, di);
0029         ei = ei - 1;
0030     end
0031 end

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005