# HG changeset patch # User Rik # Date 1302143809 25200 # Node ID 0fed4935de94c05c0c74e5b86f257241dac74550 # Parent f5a780d675a17b3b0e86e81f39123a5e6c6387df Make spectral density helper functions private. diff -r f5a780d675a1 -r 0fed4935de94 scripts/ChangeLog --- a/scripts/ChangeLog Wed Apr 06 11:44:21 2011 -0700 +++ b/scripts/ChangeLog Wed Apr 06 19:36:49 2011 -0700 @@ -1,3 +1,8 @@ +2011-04-06 Rik + + * signal/module.mk: Make spectral density helper functions private. + (rectangle_sw, rectangle_lw, triangle_sw, triangle_lw) + 2011-04-06 Rik * optimization/fminunc.m, plot/isocolors.m, plot/isonormals.m: diff -r f5a780d675a1 -r 0fed4935de94 scripts/signal/module.mk --- a/scripts/signal/module.mk Wed Apr 06 11:44:21 2011 -0700 +++ b/scripts/signal/module.mk Wed Apr 06 19:36:49 2011 -0700 @@ -1,5 +1,11 @@ FCN_FILE_DIRS += signal +signal_PRIVATE_FCN_FILES = \ + signal/private/rectangle_lw.m \ + signal/private/rectangle_sw.m \ + signal/private/triangle_lw.m \ + signal/private/triangle_sw.m + signal_FCN_FILES = \ signal/arch_fit.m \ signal/arch_rnd.m \ @@ -23,8 +29,6 @@ signal/hurst.m \ signal/ifftshift.m \ signal/periodogram.m \ - signal/rectangle_lw.m \ - signal/rectangle_sw.m \ signal/sinc.m \ signal/sinetone.m \ signal/sinewave.m \ @@ -33,10 +37,9 @@ signal/spencer.m \ signal/stft.m \ signal/synthesis.m \ - signal/triangle_lw.m \ - signal/triangle_sw.m \ signal/unwrap.m \ - signal/yulewalker.m + signal/yulewalker.m \ + $(signal_PRIVATE_FCN_FILES) FCN_FILES += $(signal_FCN_FILES) diff -r f5a780d675a1 -r 0fed4935de94 scripts/signal/private/rectangle_lw.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/signal/private/rectangle_lw.m Wed Apr 06 19:36:49 2011 -0700 @@ -0,0 +1,39 @@ +## Copyright (C) 1995-2011 Friedrich Leisch +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} rectangle_lw (@var{n}, @var{b}) +## Rectangular lag window. Subfunction used for spectral density +## estimation. +## @end deftypefn + +## Author: FL +## Description: Rectangular lag window + +function retval = rectangle_lw (n, b) + + if (nargin != 2) + print_usage (); + endif + + retval = zeros (n, 1); + t = floor (1 / b); + + retval (1:t, 1) = ones (t, 1); + +endfunction diff -r f5a780d675a1 -r 0fed4935de94 scripts/signal/private/rectangle_sw.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/signal/private/rectangle_sw.m Wed Apr 06 19:36:49 2011 -0700 @@ -0,0 +1,72 @@ +## Copyright (C) 1995-2011 Friedrich Leisch +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} rectangle_sw (@var{n}, @var{b}) +## Rectangular spectral window. Subfunction used for spectral density +## estimation. +## @end deftypefn + +## Author: FL +## Description: Rectangular spectral window + +function retval = rectangle_sw (n, b) + + if (nargin != 2) + print_usage (); + endif + + retval = zeros (n, 1); + retval(1) = 2 / b + 1; + + l = (2:n)' - 1; + l = 2 * pi * l / n; + + retval(2:n) = sin ((2/b + 1) * l / 2) ./ sin (l / 2); + +endfunction + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r f5a780d675a1 -r 0fed4935de94 scripts/signal/private/triangle_lw.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/signal/private/triangle_lw.m Wed Apr 06 19:36:49 2011 -0700 @@ -0,0 +1,38 @@ +## Copyright (C) 1995-2011 Friedrich Leisch +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} triangle_lw (@var{n}, @var{b}) +## Triangular lag window. Subfunction used for spectral density +## estimation. +## @end deftypefn + +## Author: FL +## Description: Triangular lag window + +function retval = triangle_lw (n, b) + + if (nargin != 2) + print_usage (); + endif + + retval = 1 - (0 : n-1)' * b; + retval = max ([retval'; (zeros (1, n))])'; + +endfunction + diff -r f5a780d675a1 -r 0fed4935de94 scripts/signal/private/triangle_sw.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/signal/private/triangle_sw.m Wed Apr 06 19:36:49 2011 -0700 @@ -0,0 +1,72 @@ +## Copyright (C) 1995-2011 Friedrich Leisch +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} triangle_sw (@var{n}, @var{b}) +## Triangular spectral window. Subfunction used for spectral density +## estimation. +## @end deftypefn + +## Author: FL +## Description: Triangular spectral window + +function retval = triangle_sw (n, b) + + if (nargin != 2) + print_usage (); + endif + + retval = zeros(n,1); + retval(1) = 1 / b; + + l = (2:n)' - 1; + l = 2 * pi * l / n; + + retval(2:n) = b * (sin (l / (2*b)) ./ sin (l / 2)).^2; + +endfunction + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r f5a780d675a1 -r 0fed4935de94 scripts/signal/rectangle_lw.m --- a/scripts/signal/rectangle_lw.m Wed Apr 06 11:44:21 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -## Copyright (C) 1995-2011 Friedrich Leisch -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -## -*- texinfo -*- -## @deftypefn {Function File} {} rectangle_lw (@var{n}, @var{b}) -## Rectangular lag window. Subfunction used for spectral density -## estimation. -## @end deftypefn - -## Author: FL -## Description: Rectangular lag window - -function retval = rectangle_lw (n, b) - - if (nargin != 2) - print_usage (); - endif - - retval = zeros (n, 1); - t = floor (1 / b); - - retval (1:t, 1) = ones (t, 1); - -endfunction diff -r f5a780d675a1 -r 0fed4935de94 scripts/signal/rectangle_sw.m --- a/scripts/signal/rectangle_sw.m Wed Apr 06 11:44:21 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -## Copyright (C) 1995-2011 Friedrich Leisch -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -## -*- texinfo -*- -## @deftypefn {Function File} {} rectangle_sw (@var{n}, @var{b}) -## Rectangular spectral window. Subfunction used for spectral density -## estimation. -## @end deftypefn - -## Author: FL -## Description: Rectangular spectral window - -function retval = rectangle_sw (n, b) - - if (nargin != 2) - print_usage (); - endif - - retval = zeros (n, 1); - retval(1) = 2 / b + 1; - - l = (2:n)' - 1; - l = 2 * pi * l / n; - - retval(2:n) = sin ((2/b + 1) * l / 2) ./ sin (l / 2); - -endfunction - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f5a780d675a1 -r 0fed4935de94 scripts/signal/triangle_lw.m --- a/scripts/signal/triangle_lw.m Wed Apr 06 11:44:21 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -## Copyright (C) 1995-2011 Friedrich Leisch -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -## -*- texinfo -*- -## @deftypefn {Function File} {} triangle_lw (@var{n}, @var{b}) -## Triangular lag window. Subfunction used for spectral density -## estimation. -## @end deftypefn - -## Author: FL -## Description: Triangular lag window - -function retval = triangle_lw (n, b) - - if (nargin != 2) - print_usage (); - endif - - retval = 1 - (0 : n-1)' * b; - retval = max ([retval'; (zeros (1, n))])'; - -endfunction - diff -r f5a780d675a1 -r 0fed4935de94 scripts/signal/triangle_sw.m --- a/scripts/signal/triangle_sw.m Wed Apr 06 11:44:21 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -## Copyright (C) 1995-2011 Friedrich Leisch -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -## -*- texinfo -*- -## @deftypefn {Function File} {} triangle_sw (@var{n}, @var{b}) -## Triangular spectral window. Subfunction used for spectral density -## estimation. -## @end deftypefn - -## Author: FL -## Description: Triangular spectral window - -function retval = triangle_sw (n, b) - - if (nargin != 2) - print_usage (); - endif - - retval = zeros(n,1); - retval(1) = 1 / b; - - l = (2:n)' - 1; - l = 2 * pi * l / n; - - retval(2:n) = b * (sin (l / (2*b)) ./ sin (l / 2)).^2; - -endfunction - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -