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


		%=============================
		% Sub Model
		%-----------------------------
        global shotNoisePresented
        shotNoisePresented=0
        global amInteferenceSummationPoints;
        %global ambientLightPresented
        %ambientLightPresented=0
        amInteferenceSummationPoints=1;
		%=============================
		
		%=============================
		% Default parameters
		%-----------------------------
		global ceilingHeight
		global Amax
	    global L
		global Rb
		global SNR
		ceilingHeight=12.5 %Height of the room.
		Amax=1 %Number of non-zero  amplitude levels.
	    L=1 %Maximum number of chips in symbol
		Rb=100000000
		SNR=7 %Signal To Noise Ratio, db
   	    global OOK_threshold; %In units of minumum non-zero chip.
        OOK_threshold=0.5
		%=============================

		%=============================
		%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 bh %Convolution b*h, Array
	    global lambda %(min non-zero Intensity)/average Intensity:
		%=============================

        
   	    %=============================
		% Spawn parameters
	    %----------------------------
        a=2.0*ceilingHeight/300000000.0
		
        avLength=L
        aphabetCount=1;
        for i=1:L
            aphabetCount=aphabetCount*(Amax+1);
        end
        aphabetCount
        M=log(aphabetCount)/log(2.0)
        lambda=2.0/Amax
        
        %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];
        bh=[1:tapsNumber+L]; %Reserve space. Perhaps we will need only last element.
        %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
    
        simulateThresholding();
        
        

Copyright (C) 2009 Konstantin Kirillov