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 by Telia Research AB, Lulea, Sweden; All rights reserved. % Project : FSAN duplex model % Author(s) : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se) % : Tomas Nordstrom (Tomas.B.Nordstrom@Telia.se) % % CVS: $Id: plotResult.m,v 1.2 1999/03/31 13:16:19 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 %% =========================================================================== % Check arguments if nargin<4, error('Not enough input arguments.'); end if nargin<5, ftype='Linear'; end if nargin<6, if strcmp(ftype,'Log'), fax.min=7e3; fax.max=30e6; else fax.max=0; for n=1:length(ex.tt.dm), tfplan=getList(ex.tfplist,result(n).Modem); tmp=max([tfplan.active.upstream tfplan.active.downstream])+1e6; fax.max=max(fax.max,tmp); fax.min=ex.param.minfrequency; end; end end n=length(result); if modemno>n, error('No such modem.'); end %% =========================================================================== % Get hold of some global parameters SNRmax=ex.param.SNRMax; Gamma=ex.param.shannonGap; f=ex.param.f; % Set up useful plot axis axvec=[fax.min fax.max ex.param.backgroundNoise -40]; %% =========================================================================== % Now plot the selected curves tfplan = getList(ex.tfplist,ex.param.vdslDuplex); % Get the time division TimeDivision_up=tfplan.timeDivision.up; TimeDivision_down=tfplan.timeDivision.down; modem=ex.tt.traffic{ex.tt.dm(modemno),3}; if strncmp(modem,'VDSL',4), 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 noise_LT=Tot_LT; if strcmp(ftype,'Log') semilogx(f,10*log10(result(modemno).LT.Rx_signal),'b',... f,10*log10(result(modemno).LT.Alien_noise),'k',... f,10*log10(Tot_LT),'r') else plot(f,10*log10(result(modemno).LT.Rx_signal),'b',... f,10*log10(result(modemno).LT.Alien_noise),'k',... f,10*log10(Tot_LT),'r') end titlestr=sprintf('%s LT end',modem); title(titlestr); axis(axvec); xlabel('Frequency'); grid on; elseif strcmp(side,'NT'), % Plot the NT side noise_NT=Tot_NT; if strcmp(ftype,'Log') semilogx(f,10*log10(result(modemno).NT.Rx_signal),'b',... f,10*log10(result(modemno).NT.Alien_noise),'k',... f,10*log10(Tot_NT),'r') else plot(f,10*log10(result(modemno).NT.Rx_signal),'b',... f,10*log10(result(modemno).NT.Alien_noise),'k',... f,10*log10(Tot_NT),'r') end titlestr=sprintf('%s NT end',modem); title(titlestr); axis(axvec); xlabel('Frequency'); grid on; else error('Side not recognized.'); end