view rDiff/src/locfit/m/lfsmooth.m @ 0:0f80a5141704

version 0.3 uploaded
author vipints
date Thu, 14 Feb 2013 23:38:36 -0500
parents
children
line wrap: on
line source

function yhat=lfsmooth(varargin)
%
% a simple interface to locfit.
% 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;
%

% Minimal input validation    
if nargin < 1
   error( 'At least one input argument required' );
end

fit = locfit(x,varargin{:},'module','simple');
yhat = fit.fit_points.fitted_values;

return;