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

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

    %Calculate ambient light average energy contribution over time t2-t1 starting
	%from time t1. 
	%Returns: 1/dt*Integral_over amV by dt.
	%Purpose: calculate noise applied to one chip:

%
%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 retv=am_vi(t1, dt)

    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.
		sum1=dt;

		%Calculate member 2:
		sum2=0.0;
		for i=1:20
            a0=PI2*100*i;
			a1=a0-PI2*50;
            delta0=a0*dt*0.5;
			delta1=a1*dt*0.5;
			alpha1=a1*t1+am_zeta(i)+delta1;
            alpha0=a0*t1+am_fi(i)+delta0;
			sum2 = sum2+am_b(i)*2.0*(  
             				    	sin(delta1)*cos(alpha1)/a1+
             				    	sin(delta0)*cos(alpha0)/a0
			                    );
		end
		sum2=sum2*am_A1_reciprocal;
		%Calculate member 3:
		
		a1=PI2*am_fh;
		delta=a1*dt*0.5;
		alpha=a1*t1+am_teta(1)+delta;
		sum3=am_d(1)*2.0*sin(delta)*cos(alpha)/a1;
		for i=1:11
			a1=PI2*2*i*am_fh; 
            alpha=a1*t1+am_teta(i+1)+delta;
			sum3 = sum3 + am_d(i+1)*sin(delta)*cos(alpha)/a1;
		end
		sum3=sum3*am_A2_reciprocal;
		
		sum=(sum1+sum2+sum3)/dt;
		%UTil.con("amV="+sum);
		
		retv=sum;
end


Copyright (C) 2009 Konstantin Kirillov