www.gusucode.com > UWB_matlab源码程序 > CP0902/cp0902_effpulse.m

    % 
% Function 9.6: "cp0902_effpulse"
%
% Evaluates the effective pulse duration of the
% input waveform 'pulse' sampled with frequency 'fc'.
% 'pE' is the fraction of the original energy which must
% be considered for determining the effective duration.
%
% The function returns the waveform 'eff_pulse'
% which contains the fraction 'pE' of the original energy,
% and the time duration 'Tm' in seconds of 'eff_pulse'.
%
% Programmed by Guerino Giancola
%

function [eff_pulse,Tm] = cp0902_effpulse(pulse,fc,pE)

% -----------------------------------------------------
% Step One - Evaluation of the effective pulse duration
% -----------------------------------------------------

dt = 1 / fc;
T = length(pulse);
E = sum((pulse.^2).*dt);
Eeff = E*pE;

eff_pulse = pulse;
E0 = E;
T0 = T;
while (E0>Eeff)&(T0>2)
    
    T0 = T0 - 2;
    tmp = eff_pulse(2:length(eff_pulse)-1);
    eff_pulse = tmp;
    E0 = sum((eff_pulse.^2).*dt);
    
end % while E0 > Eeff

Tm = length(eff_pulse)*dt;