--- a/inst/tkrgdatasmooth.m
+++ b/inst/tkrgdatasmooth.m
@@ -1,32 +1,34 @@
-%%[ys, lambda] = tkrgdatasmooth (x, y)
-%%[ys, lambda] = tkrgdatasmooth (x, y, d)
-%%[ys, lambda] = tkrgdatasmooth (x, y, d, option, value)
-%%
-%% Smooths the y values of 1D data by Tikhonov regularization.  The x
-%% values need not be equally spaced but they should be ordered (and
-%% non-overlapping). The order of the smoothing derivative 'd', can be
-%% provided (default is 2), and the option-value pair should be either
-%% the regularizaiton parameter "lambda" or the standard deviation
-%% "stdev" of the randomness in the data.  With no option supplied,
-%% generalized cross-validation is used to determine lambda.
-%% Reference: Anal. Chem. (2003) 75, 3631.
-%% See also:  tkrgscatdatasmooth,
-%%
+## Copyright (C) 2008 Jonathan Stickel
+## This program 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 2 of the License, or
+## (at your option) any later version.
+##
+## This program 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 this program; If not, see <http://www.gnu.org/licenses/>. 
 
+## -*- texinfo -*-
+##@deftypefn {Function File} {[@var{ys}, @var{lambda}] =} tkrgdatasmooth (@var{x}, @var{y})
+##@deftypefnx {Function File} {[@var{ys}, @var{lambda}] =} tkrgdatasmooth (@var{x}, @var{y}, @var{o})
+##@deftypefnx {Function File} {[@var{ys}, @var{lambda}] =} tkrgdatasmooth (@var{x}, @var{y}, @var{o}, @var{option}, @var{value})
+##
+## Smooths the @var{y} values of 1D data by Tikhonov regularization.
+## The @var{x} values need not be equally spaced but they should be
+## ordered (and non-overlapping). The order of the smoothing derivative
+## @var{o}, can be provided (default is 2), and the option-value pair
+## should be either the regularizaiton parameter "lambda" or the
+## standard deviation "stdev" of the randomness in the data.  With no
+## option supplied, generalized cross-validation is used to determine
+## lambda.
+## Reference: Anal. Chem. (2003) 75, 3631.
+## @seealso{tkrgscatdatasmooth}
+## @end deftypefn
 
-%% Copyright (C) 2008 Jonathan Stickel
-%% This program 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 2 of the License, or
-%% (at your option) any later version.
-%%
-%% This program 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 this program; If not, see <http://www.gnu.org/licenses/>. 
 
 
 function [ys, lambda] = tkrgdatasmooth (x, y, d, option, value)
@@ -48,19 +50,19 @@
   guess = 0;
   if (nargin > 3)
     if ( strcmp(option,"lambda") )
-      %% if lambda provided, use it directly
+      ## if lambda provided, use it directly
       lambda = value;
     elseif ( strcmp(option,"stdev") )
-      %% if stdev is provided, scale it and use it
+      ## if stdev is provided, scale it and use it
       stdev = value;
       opt = optimset("TolFun",1e-6,"MaxFunEvals",20);
       log10lambda = fminunc ("tkrgdatasmddwrap", guess, opt, x, y, d, "stdev", stdev);
       lambda = 10^log10lambda;
     else
-      warning("option %s is not recognized; using cross-validation",option)
+      warning("option #s is not recognized; using cross-validation",option)
     endif
   else
-    %% perform cross-validation
+    ## perform cross-validation
     opt = optimset("TolFun",1e-4,"MaxFunEvals",20);
     log10lambda = fminunc ("tkrgdatasmddwrap", guess, opt, x, y, d, "cve");
     lambda = 10^log10lambda;
@@ -87,12 +89,15 @@
 %! ys2p = ddmat(x,2)*ys;
 %! figure(1);
 %! plot(x,y,'o',x,ys)
+%! title("y(x)")
 %! figure(2);
 %! plot(x(1:end-1),[yp,ysp])
 %! axis([min(x),max(x),min(ysp)-abs(min(ysp)),max(ysp)*2])
+%! title("y'(x)")
 %! figure(3)
 %! plot(x(2:end-1),[y2p,ys2p])
 %! axis([min(x),max(x),min(ys2p)-abs(min(ys2p)),max(ys2p)*2])
+%! title("y''(x)")
 %! %--------------------------------------------------------
 %! % this demo used generalized cross-validation to determine lambda
 
@@ -112,12 +117,15 @@
 %! ys2p = ddmat(x,2)*ys;
 %! figure(1);
 %! plot(x,y,'o',x,ys)
+%! title("y(x)")
 %! figure(2);
 %! plot(x(1:end-1),[yp,ysp])
 %! axis([min(x),max(x),min(ysp)-abs(min(ysp)),max(ysp)*2])
+%! title("y'(x)")
 %! figure(3)
 %! plot(x(2:end-1),[y2p,ys2p])
 %! axis([min(x),max(x),min(ys2p)-abs(min(ys2p)),max(ys2p)*2])
+%! title("y''(x)")
 %! %--------------------------------------------------------
 %! % this demo used standard deviation to determine lambda
 
@@ -137,11 +145,14 @@
 %! ys2p = ddmat(x,2)*ys;
 %! figure(1);
 %! plot(x,y,'o',x,ys)
+%! title("y(x)")
 %! figure(2);
 %! plot(x(1:end-1),[yp,ysp])
 %! axis([min(x),max(x),min(ysp)-abs(min(ysp)),max(ysp)*2])
+%! title("y'(x)")
 %! figure(3)
 %! plot(x(2:end-1),[y2p,ys2p])
 %! axis([min(x),max(x),min(ys2p)-abs(min(ys2p)),max(ys2p)*2])
+%! title("y''(x)")
 %! %--------------------------------------------------------
 %! % this demo used a user specified lambda that was too large