Home > lukes_code > trigPoint > demodStartIndexFinder.m

demodStartIndexFinder

PURPOSE ^

Find starting index of modulation

SYNOPSIS ^

function ichoice = demodStartIndexFinder( x )

DESCRIPTION ^

 Find starting index of modulation
 Assume modulation of wavelength = imax
 Assume 4 points on and the rest off or building up

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ichoice = demodStartIndexFinder( x )
0002 % Find starting index of modulation
0003 % Assume modulation of wavelength = imax
0004 % Assume 4 points on and the rest off or building up
0005 imax = 10;
0006 istart = 1;
0007 % Loop through i values
0008 while istart<imax
0009     i = istart;
0010     j = 1;
0011     while i<( length( x )-imax )
0012         y( j ) = x( i );
0013         y( j+1 ) = x( i+1 );
0014         y( j+2 ) = x( i+2 );
0015         y( j+3 ) = x( i+3 );
0016         i = i + imax;
0017         j = j + 4;
0018     end
0019     % Score this choice of i
0020     score( istart ) = sum( y );
0021     ival( istart ) = istart;
0022     istart = istart + 1;
0023 end
0024 % Pick the best i value
0025 [ maxScore,maxScoreIndex ] = max( score );
0026 ichoice = ival(maxScoreIndex);
0027 end

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005