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

%Test case for PAM with ISI, shot noise, and ambient light.

		%=============================
		% Sub Model Usage
		%-----------------------------
        global shotNoisePresented
        shotNoisePresented=1
        global amInteferenceSummationPoints;
        %global ambientLightPresented
        %ambientLightPresented=0
        
        %   amInteferenceSummationPoints.     
        %       If this parameter>1 then ambient noise is taken into account,
        %       and this parameter is a number of integration points.
        %       Set this parameter to 1 to disable ambient light.
        %       Integration accracy is proportional to this parameter.
        amInteferenceSummationPoints=2;
		%=============================
		
		%=============================
		% Default parameters
		%-----------------------------
		global ceilingHeight
		global Amax
	    global L
		global Rb
		global SNR
        global amSAR
        global amInterferencePeriodTi
		ceilingHeight=3.5 %Height of the room.
		Amax=1 %Number of non-zero  amplitude levels.
	    L=2 %Maximum number of chips in symbol
		Rb=100000000
		SNR=2 %Signal To Noise Ratio, db
        amInterferencePeriodTi=25.0e-6 %In seconds.
        amSAR=1.0 %Signal to Ambient light Ratio.  = amSAR = 1/K where K is parameter from [Wong at all].
		%=============================

		%=============================
		%Derivative parameters:
		global a %ISI length parameter in chips. Parameter of h-function.
	    global SN %SNR not in dB form:	    
		global T %Chip length, seconds.
	    global avLength %Average number of chips in symbol.
		global aphabetCount %Number of symbols in alphabet
		global M %Bits per symbol
		global bitsPerChip
		global scaled_chip_length %T/a
	    global tapsNumber %"Memory" of multipath channel.
	    global beta  %Discretized h., Array
	    global lambda %(min non-zero Intensity)/average Intensity:
		%=============================

        
   	    %=============================
		% Spawn parameters
	    %----------------------------
        a=2.0*ceilingHeight/300000000.0
		
        avLength=L
        aphabetCount=L

        M=log(aphabetCount)/log(2.0)
        lambda=L
        
        %Part II:
        bitsPerChip=M/avLength
		T=bitsPerChip/Rb

		scaled_chip_length=T/a
        
		tapsNumber= int32(floor((a/T*1.25)))+1
			
		%Convert SN from dB to numbers:
		SN=exp( SNR/10.0*log(10.0) )
   	    %=============================

		beta=[1:tapsNumber];
        %Create beta:
		for k=1:tapsNumber
			beta(k)=betaPortion(k-1, scaled_chip_length);
	    end
        beta %This simply prints arrya beta (to console?)
        q=[1:tapsNumber];
        %plot(q,beta,'r');
        %legend("beta");
        %hold on
    
        am_prepare();
        simulatePPM();
        
        

Copyright (C) 2009 Konstantin Kirillov