Source Code
Infrared Signal Coding Schemes
home top contents previous up next

    %==========================================
	%  Ambient light
    %==========================================

    
	
    
	%Here we are programming formula [7 (7)]:
	%Factors R and Pm are not included into m(t) as in formula (7):
	protected double am_mi(double t){
    
    global am_b
    global am_c
    global am_zeta
    global am_fi
    global am_d
    global am_teta
    global am_A1_reciprocal
    global am_A2_reciprocal;
    %Fundamental frequency of high frequency component in (7), Hz:
    global am_fh
    global PI2

		%Calculate member 1 in (7), RPm.
		double sum1=1.0;

		%Calculate member 2:
		double sum2=0.0;
		for(int i=1; i<=20; i++){
			sum2 += am_b[i]*Math.cos(PI2*(100*i-50)*t+am_zeta[i])+
			am_c[i]*Math.cos(PI2*(100*i+am_fi[i]));
		}
		sum2*=am_A1_reciprocal;
		%Calculate member 3:
		
		double sum3=am_d[0]*Math.cos(PI2*am_fh*t+am_teta[0]);
		for(int i=1; i<=11; i++){
			sum3 += am_d[i]*Math.cos(PI2*2*i*am_fh*t+am_teta[i]);
		}
		sum3*=am_A2_reciprocal;
		
		double sum=sum1+sum2+sum3;
		%UTil.con("amV="+sum);
		
		return sum;
	}


Copyright (C) 2009 Konstantin Kirillov