Home > chronux_1_15 > locfit > lfsmooth.m

lfsmooth

PURPOSE ^

a simple interface to locfit that does smoothing on a set of observations

SYNOPSIS ^

function yhat=lfsmooth(varargin)

DESCRIPTION ^

 a simple interface to locfit that does smoothing on a set of observations

 Usage: yhat=lfsmooth(varargin)

 output is a vector of smoothed values, at each data point.
 all locfit options, except evaluation structures, are valid.

 Example, to smooth a time series of observations,

 t = (1:100)';
 y = 2*sin(t/10) + normrnd(0,1,100,1);
 plot(t,y,'.');
 hold on;
 plot(t,lfsmooth(t,y,'nn',0.5));
 hold off;

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function yhat=lfsmooth(varargin)
0002 % a simple interface to locfit that does smoothing on a set of observations
0003 %
0004 % Usage: yhat=lfsmooth(varargin)
0005 %
0006 % output is a vector of smoothed values, at each data point.
0007 % all locfit options, except evaluation structures, are valid.
0008 %
0009 % Example, to smooth a time series of observations,
0010 %
0011 % t = (1:100)';
0012 % y = 2*sin(t/10) + normrnd(0,1,100,1);
0013 % plot(t,y,'.');
0014 % hold on;
0015 % plot(t,lfsmooth(t,y,'nn',0.5));
0016 % hold off;
0017 %
0018 
0019 % Minimal input validation
0020 if nargin < 1
0021    error( 'At least one input argument required' );
0022 end
0023 
0024 fit = locfit(x,varargin{:},'what','simple');
0025 yhat = fit{4}{2};
0026 
0027 return;

Generated on Tue 15-Aug-2006 22:51:57 by m2html © 2003