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

%Abandoned  test case for convolve

		%=============================
		% Sub Model
		%-----------------------------
        global shotNoisePresented
        shotNoisePresented=1;
        global ambientLightPresented
        ambientLightPresented=0;
		%=============================
		
		%=============================
		% Default parameters
		%-----------------------------
		global ceilingHeight
		global Amax
	    global L
		global Rb
		global SNR
		ceilingHeight=3.5; %Height of the room.
		Amax=3; %Number of non-zero  amplitude levels.
	    L=2; %Maximum number of chips in symbol
		Rb=200000000;
		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 lambda; %(min non-zero Intensity)/average Intensity:
		%=============================

        
   	    %=============================
		% Spawn parameters
	    %----------------------------
        a=2.0*ceilingHeight/300000000.0; 
		
	    i=L;
        avLength=L;	         
        aphabetCount=Amax+1;
        while(--i>0)
            aphabetCount*=Amax+1;
        end
        M=log(aphabetCount)/log(2.0);
        lambda=2.0/Amax;
        
        %Part II:
        bitsPerChip=M/avLength;
		T=bitsPerChip/Rb;

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

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

        %transmitted pulses:
        b=[0.0,0.0,0.0,1.0,0.0,1.0];
        b
        %q=[1:size(b,2)];
        %plot(q,b,'b');
        %legend("b");
        %hold on
        
        %received pulses:
        S=[0.0,0.0,0.0,0.0,0.0,0.0];
        S=convolve(1,b,S);
        S
        %q=[1:size(S,2)];
        %plot(q,S,'m');
        %legend("S");


Copyright (C) 2009 Konstantin Kirillov