ContentsIndexReferenceHome
PreviousUpNext
inpaint_nans
MATLAB
B = inpaint_nans(A,[method])
Description

Solves approximation to one of several pdes to interpolate and extrapolate holes in an array

Parameters
Parameters 
Description 
A [array] 
NxM array with some NaNs to be filled in 
method [scalar] 
(Optional) Scalar numeric flag - specifies which approach (or physical metaphor) to use for the interpolation. All methods are capable of extrapolation, some are better than others. There are also speed differences, as well as accuracy differences for smooth surfaces. 
Return Values
Return Values 
Description 
B [array] 
NxM array with NaNs replaced 
Notes

Refer to in-code comments for more detailed description of methods methods {0,1,2} use a simple plate metaphor. method 3 uses a better plate equation, but may be much slower and uses more memory. method 4 uses a spring metaphor. method 5 is an 8 neighbor average, with no rationale behind it compared to the other methods. I do not recommend its use.

Examples

>> [x,y] = meshgrid(0:.01:1); 

>> z0 = exp(x+y); 

>> znan = z0; 

>> znan(20:50,40:70) = NaN; 

>> znan(30:90,5:10) = NaN; 

>> znan(70:75,40:90) = NaN; 

>> z = inpaint_nans(znan);

See Also

griddata, interp1

Group
Made with Doc-O-Matic.
Copyright (c) 2009. All rights reserved.
What do you think about this topic? Send feedback!