function plotResult(ex,result,modemno,side,ftype,fax); %% =========================================================================== %plotResult - Plot the resulting transmission curves % % Parameter: ex The experiment parameters % Parameter: result The experiment result structure % Parameter: modemno The modem number to plot % Parameter: side Indicate if we are looking at NT or LT side % 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 % % Example(s): % figure; % plotResult(ex,result,2,'NT'); % % Algorithmic details: % % Reference: %% =========================================================================== %% =========================================================================== % Copyright (C): % 1998-1999 by Telia Research AB, Lulea, Sweden; % 2000-2001 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FSAN duplex model % Author(s) : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se) % : Tomas Nordstrom (Tomas.Nordstrom@FTW.at) % % CVS: $Id: plotResult.m,v 1.14 2001/08/22 18:12:57 tono Exp $ %% =========================================================================== % Change History % 1998-12-17 (ToNo) Created % 1998-12-21 (ToNo) Restructured calculations % 1998-12-22 (ToNo) Made use of getTFplan to clean up things % 1999-01-14 (ToNo) Added support for Log axis and specially % defined frequency axes; fixed title bug for ADSL % 1999-02-25 (ToNo) Generlized list (tfplist) handling % 1999-03-01 (DaB) Updated to correct addition bug % 1999-03-03 (DaB) Renamed bg to Alien % 1999-08-19 (DaB) updated for new tfplan struct % 1999-10-01 (DaB) Rewritten for new ex struct % 2000-05-02 (ToNo) Added legend to curves. Removed a mixup % in plotting Tot_LT instead of Tot_NT % 2000-12-14 (GS) Added abs() for vectors to be plotted % 2001-07-05 (ToNo) Now we support two-sided colored background noise %% =========================================================================== % Check arguments if nargin<4, error('Not enough input arguments.'); end if nargin<5, ftype='Linear'; end dm=getDM(ex.tt.traffic,ex.param.modemlist); if nargin<6, if strcmp(ftype,'Log'), fax.min=7e3; fax.max=30e6; else fax.max=0; for n=1:length(dm), tfplan=getList(ex.tfplist,result(n).Modem.Name); tmp=max([tfplan.PSD.active.upstream tfplan.PSD.active.downstream])+1e6; fax.max=max(fax.max,tmp); fax.min=ex.param.frequency.min; end; end end n=length(result); if modemno>n, error('No such modem.'); end %% =========================================================================== % Get hold of some global parameters f=ex.param.frequency.f; % Set up useful plot axis lowest=min([eval(ex.param.bgNoise.LT) eval(ex.param.bgNoise.NT)]); axvec=[fax.min fax.max lowest -40]; %% =========================================================================== % Now plot the selected curves tfplan=getList(ex.tfplist,result(modemno).Modem.Name); % Get the time division TimeDivision_up=tfplan.timeDivision.up; TimeDivision_down=tfplan.timeDivision.down; modem=ex.tt.traffic{dm(modemno),3}; if strncmp(modem,'VDSL',4), % Fix for VDSL TDD Tot_NT=result(modemno).NT.Tot_noise.down; Tot_LT=result(modemno).LT.Tot_noise.up; else Tot_NT=result(modemno).NT.Tot_noise.up; Tot_LT=result(modemno).LT.Tot_noise.down; end; if strcmp(side,'LT') % Plot the LT side if strcmp(ftype,'Log') semilogx(f,10*log10(abs(result(modemno).LT.Rx_signal)),'b',... f,10*log10(abs(result(modemno).LT.Alien_noise)),'k',... f,10*log10(abs(Tot_LT)),'r') else plot(f,10*log10(abs(result(modemno).LT.Rx_signal)),'b',... f,10*log10(abs(result(modemno).LT.Alien_noise)),'k',... f,10*log10(abs(Tot_LT)),'r') end titlestr=sprintf('%s LT end',modem); title(titlestr); axis(axvec); xlabel('Frequency'); grid on; legend('Rx','Alien noise','Total noise'); elseif strcmp(side,'NT'), % Plot the NT side if strcmp(ftype,'Log') semilogx(f,10*log10(abs(result(modemno).NT.Rx_signal)),'b',... f,10*log10(abs(result(modemno).NT.Alien_noise)),'k',... f,10*log10(abs(Tot_NT)),'r') else plot(f,10*log10(abs(result(modemno).NT.Rx_signal)),'b',... f,10*log10(abs(result(modemno).NT.Alien_noise)),'k',... f,10*log10(abs(Tot_NT)),'r') end titlestr=sprintf('%s NT end',modem); title(titlestr); axis(axvec); xlabel('Frequency'); grid on; legend('Rx','Alien noise','Total noise'); else error('Side not recognized.'); end