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

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

%
%Credit: Data has been used from the following source:
% Adriano J.C. Moreira, Rui T. Valadas and A.M. de Oliveira Duarte.
% Optical interference produced by artificial light.
% Wireless Networks 3 (1997) 131–140
%
	
	function am_prepare()
    
        global am_b
        am_b=[1:20];
        global am_c
        am_c=[1:20];
        global am_zeta
        am_zeta=[1:20]; 
        global am_fi
        am_fi=[1:20];
        global am_d %shifted from 0 to 1
        am_d=[1:13]; 
        global am_teta %shifted from 0 to 1
        am_teta=[13]; 
        global am_A1_reciprocal
        global am_A2_reciprocal
        %Fundamental frequency of high frequency component in (7), Hz:
        global am_fh
        global PI2
        am_A1_reciprocal=1.0/5.9;
        am_A2_reciprocal=1.0/2.1;
        am_fh=37.5E3; 
        PI2=2*pi;

   		log10 = log(10);
        
		for i=1:20
			am_b(i)=exp(  log10*(  -13.1*log(100*i-50) +27.1  )/20       );
			am_c(i)=exp(  log10*(  -20.8*log(100*i) + 92.4    )/20       );
		end
		%[7] Table I:
		amAux=[ 	1, 4.65, 0.00, 11, 1.26, 6.00, 	2, 2.86, 0.08, 12, 1.29, 6.17, 				3, 5.43, 6.00, 13, 1.28, 5.69, 				4, 3.90, 5.31, 14, 0.63, 5.37, 				5, 2.00, 2.27, 15, 6.06, 4.00, 				6, 5.98, 5.70, 16, 5.49, 3.69,  				7, 2.38, 2.07, 17, 4.45, 1.86,  				8, 4.35, 3.44, 18, 3.24, 1.38,  				9, 5.87, 5.01, 19, 2.07, 5.91,  			   10, 0.70, 6.01, 20, 0.87, 4.88  		];
		for ii=1:10
			for jj=1:2
                j=jj-1;
				pos=(ii-1)*6+j*3+1;
				i=ii+10*j;
				am_zeta(i)=amAux(pos+1);
			    am_fi(i)=amAux(pos+2);
			end
		end
	    %Check our selves:
		for i=1:10
			j=i+10;
			%sprintf("%d  %f   %f  %d  %f %f", i,am_zeta(i),am_fi(i),j,am_zeta(j),am_fi(j))
		end
 		sprintf(" \n")
		
		%[7] Table II. Amplitude and phase parameters for high-frequency components.
        amAux2=[ 	 0, -22.22, 5.09, 6, -39.30, 3.55, 	       1,   0.00, 0.00, 7, -42.70, 4.15, 	       2, -11.50, 2.37, 8, -46.40, 1.64, 	       3, -30.00, 5.86, 9, -48.10, 4.51, 	       4, -33.90, 2.04, 10, -53.10, 3.55, 	       5, -35.30, 2.75, 11, -54.90, 1.78 	    ]; 
	    for ii=1:6
		    for jj=1:2
                j=jj-1;
			    pos=(ii-1)*6+j*3+1;
			    i=ii+6*j;
			    am_d(i)=amAux2(pos+1);
		        am_teta(i)=amAux2(pos+2);
			end
		end  
	    %Check our selves:
		for i=1:6
			j=i+6;
			%sprintf("%d  %f   %f  %d  %f %f", i,am_d(i),am_teta(i),j,am_d(j),am_teta(j))
		end
	end
    

Copyright (C) 2009 Konstantin Kirillov