function [phi_tot] = getABCD(ex,start,stop,topology,f,Zterm) %getABCD - Get the ABCD parameters % 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: phi The ABCD parameters % A=phi_tot{1}; % B=phi_tot{2}; % C=phi_tot{3}; % D=phi_tot{4}; % % Example(s): % segs = size(ex.tt.topology); % f = ex.param.frequency.f; % phi_tot = getABCD(ex,1,segs(1),ex.tt.topology,f,ex.param.Zterm); % Zl = ex.param.Zterm; % Zin = (phi_tot{1,1}.*Zl+phi_tot{1,2})./(phi_tot{2,1}.*Zl+phi_tot{2,2}); % % Reference: % FTW's xDSLsimu manual %% =========================================================================== %% =========================================================================== % Copyright (C): % 1999 by Telia Research AB, Lulea, Sweden; % 2000-2009 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FTW's xDSLsimu % Author(s) : Tomas Nordstrom (Tomas.Nordstrom@FTW.at) % : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se) % : Bo Engstrom (bosse@upzide.com) % % CVS: $Id: getABCD.m 752 2009-01-02 13:03:52Z tono $ %% =========================================================================== % 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) Split out ABCD calcs to its own function % (Makes it easier to do calc things like Zin) % 2001-01-04 (InJo) Fixed bug in index start (added +1) % 2001-02-22 (ToNo) Added support for insertion loss numbers % Useful for splitters and cable models % given as an IL number % 2001-06-18 (Bosse) Octave port % 2002-07-01 (PeKa) Octave to Matlab compatibility port % 2002-07-30 (ToNo) Speed things up by reducing duplicated calculations % 2003-11-03 (ToNo) Lists now use cell arrays for both Octave and Matlab % 2005-04-18 (ToNo) Added support for f==0 %% =========================================================================== % Start with unity matrix phi_tot={1,0,0,1}; R0tot = 0; % Handle f==0 fzflag =0; if f(1)==0 f=[f(2), f(2:end)]; % f(1) is now a place holder fzflag =1; end for index=start+1:stop, seg=topology{index}; cablename=seg{2}; if ~isempty(cablename), % Take care of a cable section cablemodel = getList(ex.clist,cablename); switch cablemodel.model case 'IL' d=seg{1}/1000; phi={1,getBFromIL(cablemodel,f,Zterm,d),0,1}; otherwise [Z0,gamma,R0] = getTwoPortModel(cablemodel,f); d=seg{1}/1000; gd=gamma*d; cgd = cosh(gd); sgd = sinh(gd); phi={cgd,Z0.*sgd,1./Z0.*sgd,cgd}; R0tot=R0tot+R0*d; end; phi_tot=ABCDprod(phi_tot,phi); end if length(seg)>5, cablename=seg{6}; else cablename=''; end if ~isempty(cablename), % Take care of a bridge tap (with open circuit termination) d=seg{5}/1000; cablemodel = getList(ex.clist,cablename); [Z0,gamma] = getTwoPortModel(cablemodel,f); phi={1,0,1./Z0.*tanh(gamma*d),1}; phi_tot=ABCDprod(phi_tot,phi); end; end; if fzflag==1, % Fix f==0 phi_tot{1}(1)=1; phi_tot{2}(1)=R0tot; phi_tot{3}(1)=0; phi_tot{4}(1)=1; end;