# lfsmooth

## PURPOSE

## SYNOPSIS

function yhat=lfsmooth(varargin)

## DESCRIPTION

     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;

## CROSS-REFERENCE INFORMATION

This function calls:

- locfit Smoothing noisy data using Local Regression and Likelihood.

This function is called by:

## SOURCE CODE

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