annotate rDiff/src/locfit/m/lfsmooth.m @ 3:29a698dc5c7e default tip

Merge multiple heads.
author Dave Bouvier <dave@bx.psu.edu>
date Mon, 27 Jan 2014 14:15:36 -0500
parents 0f80a5141704
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
1 function yhat=lfsmooth(varargin)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 % a simple interface to locfit.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4 % output is a vector of smoothed values, at each data point.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 % all locfit options, except evaluation structures, are valid.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7 % Example, to smooth a time series of observations,
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 % t = (1:100)';
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 % y = 2*sin(t/10) + normrnd(0,1,100,1);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 % plot(t,y,'.');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12 % hold on;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 % plot(t,lfsmooth(t,y,'nn',0.5));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 % hold off;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 % Minimal input validation
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18 if nargin < 1
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 error( 'At least one input argument required' );
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22 fit = locfit(x,varargin{:},'module','simple');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23 yhat = fit.fit_points.fitted_values;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
25 return;