```--- a/inst/welchwin.m
+++ b/inst/welchwin.m
@@ -16,27 +16,27 @@
## this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{w}] =} welchwin (@var{L},@var{c})
+## @deftypefn {Function File} {[@var{w}] =} welchwin (@var{m},@var{c})
## Returns a row vector containing a Welch window, given by
-## @var{w}(n)=1-(n/N-1)^2,   n=[0,1, ... @var{L}-1].
-## Argument @var{L} is the length of the window.
+## @var{w}(n)=1-(n/N-1)^2,   n=[0,1, ... @var{m}-1].
+## Argument @var{m} is the length of the window.
## Optional argument @var{c} specifies a "symmetric" window (the default),
## or a "periodic" window.
##
## A symmetric window has zero at each end and maximum in the middle;
-## @var{L} must be an integer larger than 2.
-## @code{if c=="symmetric", N=(L-1)/2}
+## @var{m} must be an integer larger than 2.
+## @code{if c=="symmetric", N=(m-1)/2}
##
-## A periodic window wraps around the cyclic interval [0,1, ... @var{L}-1],
+## A periodic window wraps around the cyclic interval [0,1, ... @var{m}-1],
## and is intended for use with the DFT  (functions fft(),
## periodogram() etc).
-## @var{L} must be an integer larger than 1.
-## @code{if c=="periodic", N=@var{L}/2}.
+## @var{m} must be an integer larger than 1.
+## @code{if c=="periodic", N=@var{m}/2}.
##
## @seealso{blackman, kaiser}
## @end deftypefn

-function [w] = welchwin(L,c)
+function [w] = welchwin(m,c)

if (nargin < 1 || nargin>2 )
print_usage;
@@ -50,43 +50,43 @@
symmetric = ! strcmp(c,'periodic');
endif
##
-  ## Periodic window is not properly defined if L<2.
-  ## Symmetric window is not properly defined if L<3.
-  min_L = 2 + symmetric;
-  if ( ! isreal(L) || ! isscalar(L) || L<min_L || fix(L) != L )
-    error("arg 1 (L) must be an integer larger than %d", min_L-1 );
+  ## Periodic window is not properly defined if m<2.
+  ## Symmetric window is not properly defined if m<3.
+  min_M = 2 + symmetric;
+  if ( ! isreal(m) || ! isscalar(m) || m<min_M || fix(m) != m )
+    error("arg 1 (M) must be an integer larger than %d", min_M-1 );
endif
-  N = (L-symmetric)/2;
-  n = 0:L-1;
+  N = (m-symmetric)/2;
+  n = 0:m-1;
w = 1 - ((n-N)./N).^2;

endfunction;

%!demo
-%! L = 32;
-%! t = [0:L-1];
+%! m = 32;
+%! t = [0:m-1];
%! printf ("Graph: single period of ");
-%! printf ("%d-point periodic (blue) and symmetric (red) windows\n", L);
-%! xp = welchwin (L, "periodic");
-%! xs = welchwin (L, "symmetric");
+%! printf ("%d-point periodic (blue) and symmetric (red) windows\n", m);
+%! xp = welchwin (m, "periodic");
+%! xs = welchwin (m, "symmetric");
%! plot (t, xp, "b", t, xs, "r")

%!demo
-%! L = 32;
-%! t = [0:4*L-1];
+%! m = 32;
+%! t = [0:4*m-1];
%! printf ("Graph: 4 periods of ");
-%! printf ("%d-point periodic (blue) and symmetric (red) windows\n", L);
-%! xp = welchwin (L, "periodic");
-%! xs = welchwin (L, "symmetric");
+%! printf ("%d-point periodic (blue) and symmetric (red) windows\n", m);
+%! xp = welchwin (m, "periodic");
+%! xs = welchwin (m, "symmetric");
%! xp2 = repmat (xp, 1, 4);
%! xs2 = repmat (xs, 1, 4);
%! plot (t, xp2, "b", t, xs2, "r")

%!demo
-%! L = 32;
+%! m = 32;
%! n = 512;
-%! xp = welchwin (L, "periodic");
+%! xp = welchwin (m, "periodic");
%! s = fftshift (max (1e-2, abs (fft (postpad (xp, n)))));
%! f = [-0.5:1/n:0.5-1/n];
-%! printf ("%dx null-padded, power spectrum of %d-point window\n", n/L, L);
+%! printf ("%dx null-padded, power spectrum of %d-point window\n", n/m, m);
%! semilogy (f, s)
```