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

        %Calculates outputPulses = inputPulses * beta starting from element "start " in array outputPulses
        %where * is a discrete convolution:
	    function retv=convolve(start, inputPulses, outputPulses)
            global tapsNumber
            global beta
	    	nOut=size(outputPulses,2);
	    	nIn=size(inputPulses,2);
	    	for k=start:nOut
	    		s=0.0;
	    		for j=1:tapsNumber
	    			tail=k-j+1;
	    			if(tail<1 || tail>nIn) 
                       break;
                    end
	    			s=s+inputPulses(tail)*beta(j);
	    		end
	    		outputPulses(k)=s;
	    	end
            %It seems: formal paramter cannot be returned in MatLab.
            %Apparently we can return a vector:
            retv=outputPulses;
	    end


Copyright (C) 2009 Konstantin Kirillov