function A = getAtt(ex,start,stop,topology,f,Zterm);
%getAtt - Get the attenuation (instertion loss) 
%         between start and stop node in the topology
%
% Parameter:    ex         experiment struct
% Parameter:    start      start node
% Parameter:    stop       stop node
% Parameter:    topology   Scenario Topology
% Parameter:    f	   Frequency axis
% Parameter:    Zterm      Termination Impedance
% Returns:      A          Attenuation [dB(f)]
%
% Example(s):
%   segs = size(ex.tt.topology);
%   f = ex.param.frequency.f;
%   IL = getAtt(ex,1,segs(1),ex.tt.topology,f,ex.param.Zterm);
%   semilogx(f,IL); 
%
% Reference:
%    FSAN xDSL simulation tool manual
%% ===========================================================================

%% ===========================================================================
% Copyright (C):                                        
%       1999 by Telia Research AB, Lulea, Sweden;                
%       2000 by Forschungszentrum Telekommunikation Wien, Austria;
%                                                         All rights reserved.
% Project       : FSAN xDSL simulation tool
% Author(s)     : Tomas Nordstrom (Tomas.Nordstrom@FTW.at)
%               : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se)
%
% CVS:       $Id: getAtt.m,v 1.10 2000/07/20 13:43:12 tono Exp $
%% ===========================================================================
% Change History
%      1999-08-11 (DaB)  Created
%      2000-03-14 (ToNo) Modified how cables are defined (now in a list)
%      2000-04-03 (UvAn) Changed according to new interface of getTwoPortModel
%      2000-07-05 (GS)   Modified for also accepting bridged tap directly at LT
%      2000-07-17 (ToNo) Added comments, split out a function getABCD
%% ===========================================================================

Zl = Zterm; Zs = Zterm;
fi_tot = getABCD(ex,start,stop,topology,f,Zterm);

% Calculate the cable transfer function (insertion loss)
H=(Zs+Zl)./(fi_tot{1,1}.*Zl+fi_tot{1,2}+fi_tot{2,1}.*Zs.*Zl+fi_tot{2,2}.*Zs);
A=20*log10(abs(H));