function plotTFplan(tfplan,ftype,fax,titlestring); %plotTFplan - plots the frequency plan for a certain tfplan % % Parameter: tfplan.name The name of this plan % Parameter: tfplan.upstream The upstrean frequency plan % Parameter: tfplan.downstream The upstrean frequency plan % Parameter: tfplan.interpolation The interpolation method used % Parameter: ftype The type of frequency axis ('Log','Linear') % Parameter: fax.min The min frequency to plot % Parameter: fax.max The max frequency to plot % Parameter: titlestring Title other than tfp name % % Global parameters used: % ex.param.f Frequency plan % ex.param.HAM If HAMband should be enforced % % Example(s): % plotTFplan(tfplan) allows you to plot the frequency plan % % Reference: % FTW's xDSLsimu manual %% =========================================================================== %% =========================================================================== % Copyright (C): % 1998-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) % : Petr Kadlec (kadlec@ftw.at) % % CVS: $Id: plotTFplan.m,v 3.3 2003/03/07 16:49:02 tono Exp $ %% =========================================================================== % Change History % 1998-11-12 (ToNo) Created % 1999-01-08 (ToNo) Added fill % 1999-01-14 (ToNo) Fixed support for local frequency axis (fax) % 1999-01-15 (ToNo) Added legend the hard way % 1999-01-17 (ToNo) Fixed a plot of the whole defined frequency axis % 1999-02-08 (DaB) updated to fit new struct % 1999-02-09 (DaB) removed local freq axis % 1999-03-01 (DaB) Updated to fit new HAM band defintion % 1999-08-19 (DaB) updated for new tfplan struct % 1999-10-01 (DaB) Rewritten for new ex struct % 2001-06-15 (Bosse) Octave port % 2002-07-02 (Peka) Octave to Matlab port % 2002-07-22 (PeKa) Now we support two-sided colored background noise % 2002-07-23 (Peka) Update of the figure setup % 2003-01-07 (ToNo) Cleaning up Matlab/Octave compatibility % 2003-01-09 (ToNo) New Octave - new syntax for { and } %% =========================================================================== global ex; if nargin<1, error('Not enough input arguments.'); end if nargin<2, ftype='Linear'; end if nargin<3, fax.min=min(ex.param.frequency.f); fax.max=max([tfplan.PSD.active.upstream tfplan.PSD.active.downstream])+1e6; end if nargin<4, titlestring = sprintf('%s PSD mask',tfplan.name); end % Set up a local frequency axis (with a suitable f max) f=ex.param.frequency.f; % Set up the data upPSD = eval(sprintf('%s;',tfplan.PSD.upstream)); downPSD = eval(sprintf('%s;',tfplan.PSD.downstream)); % remove hamband if(tfplan.PSD.HAM.active == 1) hamband = getList(ex.tfplist,ex.param.HAMBandName); hamPSD = eval(sprintf('%s;',hamband.PSD.downstream)); upPSD = min(upPSD,hamPSD); downPSD = min(downPSD,hamPSD); end % log scale upPSD=10*log10(upPSD); downPSD=10*log10(downPSD); minval = min([upPSD downPSD]); maxval = max([upPSD downPSD]); lowest=min([eval([ex.param.bgNoise.LT,';']) eval([ex.param.bgNoise.NT,';'])]); highest=max([-35 eval([ex.param.bgNoise.LT,';']) eval([ex.param.bgNoise.NT,';'])]); axvec=[fax.min fax.max lowest max(maxval,highest)]; % Plot it uc=[0.7 0.7 1]; dc=[1 0.7 0.7]; f = [f(1)-1e9 f f(length(f))+1e-9]; % Fix plotting bug by adding edge points upPSD=[minval upPSD minval]; downPSD=[minval downPSD minval]; if strcmp(ftype,'Log') semilogx(f,upPSD,'-',f,downPSD,'-'); else if onMatlab fill(f,upPSD,uc,f,downPSD,dc); hold('on'); end plot(f,upPSD,'b-',f,downPSD,'r-'); end if onMatlab legend('upstream','downstream'); end axis(axvec); title(titlestring) xlabel('Frequency [Hz]'); ylabel('PSD [dBm]'); grid('on'); hold('off');