MATLAB: Does the GRIDDATAN function return NaN values when interpolating data points that are generated from smooth functions

griddatanMATLABnantsearchn

For certain cases, when I use the GRIDDATAN function to fit scattered data, the function returns NaN values. The data points are generated from smooth functions and none are external to the data, therefore I do not expect to see any NaN values in the output.
The attached file contains code that can reproduce this error.

Best Answer

This bug has been fixed in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
We have verified that there is a bug in MATLAB 7.0 (R14) that occurs when using the GRIDDATAN function.
There are currently no known workarounds.