How individual MATLAB function handle NaNs varies on a case-by-case basis (although usually with a good rationale behind it). For example, the help file for corrcoef() describes an option for how to deal with NaNs. In the case the of mean() function, there is simply a nanmean() function that ignores NaNs.
I do not see any mention of NaN in the documentation for lsqcurvefit(), so I'm guessing you'll have to deal with it on the input side. One option is to simply exclude the columns with NaNs:
A(:,any(isnan(A),1)) = [];
I don't know if that makes sense for your data.
