Mercurial > octave
changeset 12579:0fed4935de94
Make spectral density helper functions private.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Wed, 06 Apr 2011 19:36:49 -0700 |
parents | f5a780d675a1 |
children | 2c4e52c83b64 |
files | scripts/ChangeLog scripts/signal/module.mk scripts/signal/private/rectangle_lw.m scripts/signal/private/rectangle_sw.m scripts/signal/private/triangle_lw.m scripts/signal/private/triangle_sw.m scripts/signal/rectangle_lw.m scripts/signal/rectangle_sw.m scripts/signal/triangle_lw.m scripts/signal/triangle_sw.m |
diffstat | 10 files changed, 234 insertions(+), 226 deletions(-) [+] |
line wrap: on
line diff
--- 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 <octave@nomad.inbox5.com> + + * signal/module.mk: Make spectral density helper functions private. + (rectangle_sw, rectangle_lw, triangle_sw, triangle_lw) + 2011-04-06 Rik <octave@nomad.inbox5.com> * optimization/fminunc.m, plot/isocolors.m, plot/isonormals.m:
--- 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)
--- /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 +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {} rectangle_lw (@var{n}, @var{b}) +## Rectangular lag window. Subfunction used for spectral density +## estimation. +## @end deftypefn + +## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> +## 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
--- /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 +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {} rectangle_sw (@var{n}, @var{b}) +## Rectangular spectral window. Subfunction used for spectral density +## estimation. +## @end deftypefn + +## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> +## 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
--- /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 +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {} triangle_lw (@var{n}, @var{b}) +## Triangular lag window. Subfunction used for spectral density +## estimation. +## @end deftypefn + +## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> +## 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 +
--- /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 +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {} triangle_sw (@var{n}, @var{b}) +## Triangular spectral window. Subfunction used for spectral density +## estimation. +## @end deftypefn + +## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> +## 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
--- 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {} rectangle_lw (@var{n}, @var{b}) -## Rectangular lag window. Subfunction used for spectral density -## estimation. -## @end deftypefn - -## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> -## 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
--- 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {} rectangle_sw (@var{n}, @var{b}) -## Rectangular spectral window. Subfunction used for spectral density -## estimation. -## @end deftypefn - -## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> -## 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--- 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {} triangle_lw (@var{n}, @var{b}) -## Triangular lag window. Subfunction used for spectral density -## estimation. -## @end deftypefn - -## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> -## 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 -
--- 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {} triangle_sw (@var{n}, @var{b}) -## Triangular spectral window. Subfunction used for spectral density -## estimation. -## @end deftypefn - -## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> -## 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -