function [fi_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: fi The ABCD parameters % A=fi_tot{1}; % B=fi_tot{2}; % C=fi_tot{3}; % D=fi_tot{4}; % % Example(s): % segs = size(ex.tt.topology); % f = ex.param.frequency.f; % fi_tot = getABCD(ex,1,segs(1),ex.tt.topology,f,ex.param.Zterm); % Zl = ex.param.Zterm; % Zin = (fi_tot{1,1}.*Zl+fi_tot{1,2})./(fi_tot{2,1}.*Zl+fi_tot{2,2}); % % Reference: % FTW's xDSLsimu manual %% =========================================================================== %% =========================================================================== % Copyright (C): % 1999 by Telia Research AB, Lulea, Sweden; % 2000-2003 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,v 3.2 2003/11/03 12:33:22 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) 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 %% =========================================================================== % Start with unity matrix fi_tot={1,0,0,1}; 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; fi={1,getBFromIL(cablemodel,f,Zterm,d),0,1}; otherwise [Z0,gamma] = getTwoPortModel(cablemodel,f); d=seg{1}/1000; gd=gamma*d; cgd = cosh(gd); sgd = sinh(gd); fi={cgd,Z0.*sgd,1./Z0.*sgd,cgd}; end; fi_tot=ABCDprod(fi_tot,fi); 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); fi={1,0,1./Z0.*tanh(gamma*d),1}; fi_tot=ABCDprod(fi_tot,fi); end; end;