function plotResult(ex,result,modemno,side,ftype,fax,namestr); %% =========================================================================== %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-2003 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FTW's xDSLsimu % Author(s) : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se) % : Tomas Nordstrom (Tomas.Nordstrom@FTW.at) % : Bo Engstrom (bosse@upzide.com) % : Petr Kadlec (kadlec@ftw.at) % % CVS: $Id: plotResult.m,v 3.2 2003/11/03 12:33:22 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-06-21 (Bosse) Octave port % 2001-06-25 (Bosse) Added an extra title string % 2001-07-05 (ToNo) Now we support two-sided colored background noise % 2002-07-02 (Peka) Octave to Matlab port % 2002-07-23 (Peka) update of the figure setup % 2003-11-03 (ToNo) Lists now use cell arrays for both Octave and Matlab %% =========================================================================== % Check arguments error(nargchk(4,7,nargin)); if exist('ftype')~=1, ftype=[]; end if isempty(ftype), ftype='Linear'; end dm=getDM(ex.tt.traffic,ex.param.modemlist); if exist('fax')~=1,fax=[];end if isempty(fax) if strcmp(ftype,'Log'), fax.min=7e3; fax.max=30e6; else fax.max=0; for n=1:length(dm), x=result{n}; tfplan=getList(ex.tfplist,x.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 if exist('namestr')~=1,namestr=[];end,if isempty(namestr),namestr='';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 x=result{modemno}; tfplan=getList(ex.tfplist,x.Modem.Name); % Get time division TimeDivision_up=tfplan.timeDivision.up; TimeDivision_down=tfplan.timeDivision.down; modem=ex.tt.traffic{dm(modemno)}{3}; if strcmp(modem(1:4),'VDSL'), % Fix for VDSL TDD y=result{modemno}; Tot_NT=y.NT.Tot_noise.down; Tot_LT=y.LT.Tot_noise.up; else y=result{modemno}; Tot_NT=y.NT.Tot_noise.up; Tot_LT=y.LT.Tot_noise.down; end; if strcmp(side,'LT') % Plot the LT side titlestr=sprintf('%s%s LT end',namestr,modem); title(titlestr); axis(axvec); xlabel('Frequency[Hz]'); grid('on'); y=result{modemno}; if strcmp(ftype,'Log') semilogx(f,10*log10(abs(y.LT.Rx_signal)),'-',... f,10*log10(abs(y.LT.Alien_noise)),'-',... f,10*log10(abs(Tot_LT)),'-') legend ('Rx;','Alien noise;','Total noise;',0); xlabel('Frequency[Hz]'); else plot(f,10*log10(abs(y.LT.Rx_signal)),'-',... f,10*log10(abs(y.LT.Alien_noise)),'-',... f,10*log10(abs(Tot_LT)),'-') legend ('Rx;','Alien noise;','Total noise;',1); xlabel('Frequency[Hz]'); end if onMatlab axis(axvec); grid ('on'); axis ('on'); title(titlestr); end elseif strcmp(side,'NT'), % Plot the NT side titlestr=sprintf('%s%s NT end',namestr,modem); title(titlestr); axis(axvec); grid('on'); y=result{modemno}; if strcmp(ftype,'Log') semilogx(f,10*log10(abs(y.NT.Rx_signal)),'-',... f,10*log10(abs(y.NT.Alien_noise)),'-',... f,10*log10(abs(Tot_NT)),'-') legend ('Rx;','Alien noise;','Total noise;',0); xlabel('Frequency[Hz]'); else plot(f,10*log10(abs(y.NT.Rx_signal)),'-',... f,10*log10(abs(y.NT.Alien_noise)),'-',... f,10*log10(abs(Tot_NT)),'-') legend ('Rx;','Alien noise;','Total noise;',1); xlabel('Frequency[Hz]'); end if onMatlab axis(axvec); grid ('on'); axis ('on'); title(titlestr); end else error('Side not recognized.'); end