lfsmooth.m 575 B

12345678910111213141516171819202122232425
  1. function yhat=lfsmooth(varargin)
  2. %
  3. % a simple interface to locfit.
  4. % output is a vector of smoothed values, at each data point.
  5. % all locfit options, except evaluation structures, are valid.
  6. %
  7. % Example, to smooth a time series of observations,
  8. %
  9. % t = (1:100)';
  10. % y = 2*sin(t/10) + normrnd(0,1,100,1);
  11. % plot(t,y,'.');
  12. % hold on;
  13. % plot(t,lfsmooth(t,y,'nn',0.5));
  14. % hold off;
  15. %
  16. % Minimal input validation
  17. if nargin < 1
  18. error( 'At least one input argument required' );
  19. end
  20. fit = locfit(x,varargin{:},'module','simple');
  21. yhat = fit.fit_points.fitted_values;
  22. return;