function retval=makeUFplan(grid,plan,gbsize) %% =========================================================================== % makeUFplan - Make universal frequency plan out of grid and plan % % Parameter: grid The frequency grid % Parameter: plan The frequency plan % Parameter: gbsize Size of guardband between bands % Returns: retval List with the combined plan % %% =========================================================================== %% =========================================================================== % Copyright (C): % 1999 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) % % CVS: $Id: makeUFplan.m 752 2009-01-02 13:03:52Z tono $ %% =========================================================================== % Change History % 1999-08-31 (ToNo) Created % 2003-01-03 (ToNo) Changed into a list for Octave to Matlab compat. % 2003-11-03 (ToNo) Lists now use cell arrays for both Octave and Matlab % 2005-03-24 (ToNo) Added possibility to use guardbands %% =========================================================================== if nargin<2, error('To few arguments'); end if nargin<3, gbsize=0; end if length(grid) ~= length(plan)+1, error('makeUFplan: length mismatch'); end; retval = {grid(1), plan(1)}; if gbsize == 0, for pix=2:length(plan), retval = {retval{:}, grid(pix), plan(pix)}; end; else % Implement guardbands ds = gbsize/2; lastval = grid(1); for pix=2:length(plan), if grid(pix) < gbsize, % Do not bother with the lowest frequencies retval = {retval{:}, grid(pix), plan(pix)}; lastval = grid(pix); else % Check so we do not overlap with previous value if lastval<=grid(pix)-ds % To indicate a guardband we use 'n' retval = {retval{:}, grid(pix)-ds, 'n', grid(pix)+ds, plan(pix)}; else estr=sprintf('makeUFplan: grid at [... %g %g ...] mismatch with gbsize = %g ', grid(pix-1),grid(pix),gbsize); error(estr); end; end end; end; retval = {retval{:}, grid(length(grid))};