Home > lukes_code > trigPoint > lukesDemodulator.m

lukesDemodulator

PURPOSE ^

% Input

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Input
 Set x as the vector you want to de-modulate

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Input
0002 % Set x as the vector you want to de-modulate
0003 [d LL RR QQ UU] = cbassS2N( draster );
0004 
0005 x1 = QQ(:,78);
0006 x = x1(20000:length(x1));
0007 %% Automatic i finder
0008 % Assume modulation of wavelength = imax
0009 % Assume 4 points on and the rest off or building up
0010 imax = 10;
0011 istart = 1;
0012 
0013 % Loop through i values
0014 while istart<imax
0015     i = istart;
0016     j = 1;
0017     while i<( length( x )-imax )
0018         y( j ) = x( i );
0019         y( j+1 ) = x( i+1 );
0020         y( j+2 ) = x( i+2 );
0021         y( j+3 ) = x( i+3 );
0022         i = i + imax;
0023         j = j + 4;
0024     end
0025     % Score this choice of i
0026     score( istart ) = sum( y );
0027     ival( istart ) = istart;
0028     istart = istart + 1;
0029 end
0030 % Pick the best i value
0031 [ maxScore,maxScoreIndex ] = max( score );
0032 ichoice = ival(maxScoreIndex)
0033 
0034 %% Use this i choice
0035 % z is the mean of 4 signal points - mean of four bg points
0036 i = ichoice;
0037 k = 1;
0038 while i<( length(x) - imax )
0039     z(k) = mean( [x(i) x(i+1) x(i+2) x(i+3)] ) - mean( [x(i+5) x(i+6) x(i+7) x(i+8)] );
0040     i = i + 10;
0041     k = k + 1;
0042 end
0043 figure
0044 plot( z )

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