function [plan_up,plan_down]=setupPSDplan(plan, psd_up, psd_down, method, nosignal,capval) %% =========================================================================== %setupPSDplan - Generate a PSD description from a simple list % % Parameter: plan PSD mask description % Parameter: psd_up PSD-mask for upstream % Parameter: psd_down PSD-mask for downstream % Parameter: method Interpolation method ('Linear' or 'Log-Linear') % Parameter: nosignal Signal level when not sending % Parameter: capval Maximum signal level % Returns: plan_up PSD plan for upstream % Returns: plan_down PSD plan for downstream % % Example(s): % [tmp_upstream,tmp_downstream]= setupPSDplan({... % fmin 'u' .138e6 'd' 2.0e6 'u' 4.3e6, 'd' 7.1e6 ... % 'u' 10.1e6 'd' 14.35e6 'u' fmax }, ... % upstream_val, downstream_val, 'Log-Linear', -120); % % [up,down]=setupPSDplan({1e3 'u' .138e6 'd' 2.0e6 'u' 4.3e6, 'd', 7.1e6 'u' 10.1e6 'd' 14.35e6 'u' 18e6 },-40, -60, 'Log-Linear', -120) % % Algorithmic details: % % Reference: %% =========================================================================== %% =========================================================================== % Copyright (C): % 1999-2000 by Telia Research AB, Lulea, Sweden; % 2000-2009 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FTW's xDSLsimu % Author(s) : Tomas Nordstrom (Tomas.Nordstrom@ftw.at) % : Daniel Bengtsson (Daniel.Bengtsson@teliasonera.com) % : Frank Sjöberg % % CVS: $Id: setupPSDplan.m 752 2009-01-02 13:03:52Z tono $ %% =========================================================================== % Change History % 1999-01-14 (ToNo) Created % 1999-07-27 (FS) Modified from setupPSDplan to handle non-flat PSD % 2000-04-06 (UvAn) Changed default value for "nosignal" to -140 % 2002-10-11 (ToNo) Made internal function external % Fixed off-by-one errors in start and stop index % 2003-01-03 (ToNo) Octave to Matlab compatibility port % 2003-11-03 (ToNo) Lists now use cell arrays for both Octave and Matlab % 2005-01-12 (ToNo) Fixed incorrect parameters into setupPSD_def2PSD %% =========================================================================== if nargin<3, error('Not enough input arguments.'); end if nargin<4 % Default interpolation method is linear method = 'Linear'; end; if nargin<5, % Default value; (before we used nosignal=ex.param.backgroundNoise); nosignal=-140; end if nargin<6, capval=0; end plen=length(plan); if plen<3, error('setupPSDplan must have length > 3'); end; if ischar(plan{1}) || ischar(plan{plen}), error('Start and stop setupPSDplan with a frequency.'); end; plan_up=[]; plan_down=[]; for i=1:2:plen-2, start=plan{i}; direction=plan{i+1}; stop=plan{i+2}; if ischar(start) || ischar(stop), error('Frequencies should be around a direction.'); end; if stop