%% Fill Gaps in Two-Dimensional Data
% Load a file that contains depth measurements of a mold used to mint a United States penny. The data, taken at the National Institute of Standards and Technology, are sampled on a 128-by-128 grid.

load penny

%
% Draw a contour plot with 25 copper-colored contour lines.

nc = 25;

contour(P,nc)
colormap copper
axis ij square

%
% Introduce four 10-by-10 gaps into the data. Draw a contour plot of the corrupted signal.

P(50:60,80:90) = NaN;
P(100:110,20:30) = NaN;
P(100:110,100:110) = NaN;
P(20:30,110:120) = NaN;

contour(P,nc)
colormap copper
axis ij square

%
% Use fillgaps to reconstruct the data, treating each column as an independent channel. Specify an 8th-order autoregressive model extrapolated from 30 samples at each end. Draw a contour plot of the reconstruction.

q = fillgaps(P,30,8);

contour(q,nc)
colormap copper
axis ij square

% Copyright 2012 The MathWorks, Inc.