gusucode.com > UWB_matlab源码程序 > CP0901/cp0901_sm2_PPM.m

    %
% Function 9.1: "cp0901_sm2_PPM"
%
% Evaluates the term SIGMAm^2 ('sm2') for an input 'pulse'
% sampled ad 'fc'.'PPMshift' is the value in seconds
% of the PPM shift.
%
% Programmed by Guerino Giancola
%

function [sm2] = cp0901_sm2_PPM(pulse,PPMshift,fc)

% ---------------------------------
% Step One - Evaluation of SIGMAm^2
% ---------------------------------

dt = 1 / fc;
PPM_samples = floor(PPMshift/dt);
pulse_samples = length(pulse);


% energy normalization
Ep = sum((pulse.^2).*dt);
pulse = pulse./sqrt(Ep);


p0 = zeros(1,PPM_samples+pulse_samples);
p0(1:length(pulse)) = pulse;
p1 = cp0804_signalshift(p0,fc,PPMshift);
% single pulse correlator mask for PPM
v = p0-p1;

LM = length(v);
LS = LM + 2*pulse_samples;

pa = zeros(1,LS);
pb = zeros(1,LS);

pa(1:pulse_samples) = pulse;
pb(1:LM) = v;


for tau = 0 : (LS-1)
    
    pc = cp0804_signalshift(pa,fc,tau*dt);
    
    % result of the internal integration
    I(tau+1) = (sum((pc.*pb).*dt))^2;
        
end % for tau = 0 : (LS-1)

sm2 = sum(I.*dt);