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

    %
% Function 9.2: "cp0901_sm2_PAM"
%
% Evaluates the term SIGMAm^2 ('sm2') for an input 'pulse'
% sampled at 'fc'.
%
% Programmed by Guerino Giancola
%

function [sm2] = cp0901_sm2_PAM(pulse,fc)

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

dt = 1 / fc;                   % sampling period
pulse_samples = length(pulse);

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

LS = 3*pulse_samples;

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

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


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);