function plotTFplan(tfplan,ftype,fax); %plotTFplan - plots a FSAN scenario time and frequency plan % % 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 % % 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: % FSAN duplex simulation memo, Telia 1998 %% =========================================================================== %% =========================================================================== % Copyright (C) 1998,99 by Telia Research AB, Lulea, Sweden; All rights reserved. % Project : FSAN duplex model % Author(s) : Tomas Nordstrom (Tomas.B.Nordstrom@Telia.se) % : % % CVS: $Id: plotTFplan.m,v 1.2 1999/03/31 13:16:20 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 %% =========================================================================== 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.f); fax.max=max([tfplan.active.upstream tfplan.active.downstream])+1e6; end % Set up a local frequency axis (with a suitable f max) f=ex.param.f; % Set up the data upPSD = eval(tfplan.upstream); downPSD = eval(tfplan.downstream); % remove hamband if(ex.param.HAM == 1) hamband = getList(ex.tfplist,ex.param.HambandName); hamPSD = eval(hamband.downstream); upPSD = min(upPSD,hamPSD); downPSD = min(downPSD,hamPSD); end % log scale upPSD=10*log10(upPSD); downPSD=10*log10(downPSD); maxval = max([upPSD downPSD]); minval = min([upPSD downPSD]); % Plot it uc=[0.7 0.7 1]; dc=[1 0.7 0.7]; cla; if strcmp(ftype,'Log') semilogx(f,upPSD,'b',f,downPSD,'r'); else fill(f,upPSD,uc,f,downPSD,dc); hold on; plot(f,upPSD,'b',f,downPSD,'r'); end titlestring=sprintf('%s PSD mask',tfplan.name); title(titlestring); axvec=[fax.min fax.max ex.param.backgroundNoise -35]; axis(axvec); xlabel('Frequency'); % ylabel('PSD (dbM)'); grid on; %legend('upstream','downstream',4) is not working, thus, this: % Plot legend the hard way curax=get(gca,'Position') ; startx = curax(1)+curax(3)-120; starty=curax(2); h1 = axes('Box','on', 'CameraUpVector',[0 1 0], 'CLimMode','manual', ... 'Color',[1 1 1], 'DrawMode','fast', ... 'FontName','times', 'FontSize',12, 'NextPlot','add', ... 'Units','pixels', 'Position',[startx starty 120 40], ... 'XColor',[0 0 0], 'XLimMode','manual', 'XTick',-1, ... 'XTickLabelMode','manual', 'XTickMode','manual', ... 'YColor',[0 0 0], 'YLimMode','manual', 'YTick',-1, ... 'YTickLabelMode','manual', 'YTickMode','manual', 'ZColor',[0 0 0]); h2 = text('Color',[0 0 0], 'FontName','times', 'FontSize',11, ... 'Position',[0.4 0.66 0], 'String','upstream'); box1 = [0.0605 0.8333; 0.3026 0.8333; 0.3026 0.5000; 0.0605 0.5000; 0.0605 0.8333]; h2 = patch('FaceColor',uc, 'Faces',[1 2 3 4 5], 'Vertices',box1); h2 = text('Color',[0 0 0], 'FontName','times', 'FontSize',11, ... 'Position',[0.4 0.333 0], 'String','downstream'); box2 =[0.0605 0.5000; 0.3026 0.5000; 0.3026 0.1667; 0.0605 0.1667; 0.0605 0.5000]; h2 = patch('FaceColor',dc, 'Faces',[1 2 3 4 5], 'Vertices',box2); hold off;