1 ## Copyright (C) 2000 Kai Habel
3 ## This program is free software; you can redistribute it and/or modify
4 ## it under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation; either version 2 of the License, or
6 ## (at your option) any later version.
8 ## This program is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ## GNU General Public License for more details.
13 ## You should have received a copy of the GNU General Public License
14 ## along with this program; If not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function File} { } fnplt (@var{pp}, '@var{plt}')
20 ## @seealso{ppval, spline, csape}
23 ## Author: Kai Habel <kai.habel@gmx.de>
25 ## 2001-02-19 Paul Kienzle
26 ## * use pp.x rather than just x in linspace; add plt parameter
27 ## * return points instead of plotting them if desired
28 ## * also plot control points
31 function [x, y] = fnplt (pp, plt)
33 if (nargin < 1 || nargin > 2)
34 usage ("[x, y] = fnplt (pp [, plotstring])");
39 xi = linspace(min(pp.x),max(pp.x),256)';
47 plot(xi,pts,plt,pp.x,ppval(pp,pp.x),"bx;;");
53 %! x = [ 0; sort(rand(25,1)); 1 ];
54 %! pp = csape (x, sin (2*pi*3*x), 'periodic');
56 %! title('Periodic spline reconstruction of randomly sampled sine');
57 %! fnplt (pp,'r;reconstruction;');
58 %! t=linspace(0,1,100); y=sin(2*pi*3*t);
59 %! hold on; plot(t,y,'g;ideal;'); hold off;