%% Vector with NaN
% Create a noisy vector containing NaN values, and smooth the data ignoring NaN, which is the default.

A = [NaN randn(1,48) NaN randn(1,49) NaN];
B = smoothdata(A);

% Smooth the data including NaN values.  The average in a window containing NaN is NaN.

C = smoothdata(A,'includenan');

% Plot the smoothed data in B and C.

plot(1:100,B,'-o',1:100,C,'-x')
legend('Ignore NaN','Include NaN')

%
% Copyright 2012 The MathWorks, Inc.