User`s guide

fitoptions
4-111
You can return values for some fit options with the fit function. For example,
fit the census data using a smoothing spline and return the default smoothing
parameter. Note that this value is based on the data passed to
fit.
[f,gof,out] = fit(cdate,pop,'smooth');
smoothparam = out.p
smoothparam =
0.0089
Increase the default smoothing parameter by about 10% and fit again.
opts = fitoptions('Method','Smooth','SmoothingParam',0.0098);
[f,gof,out] = fit(cdate,pop,'smooth',opts);
Create two noisy Gaussian peaks one with a small width, and one with a
large width.
a1 = 15; b1 = 3; c1 = 0.02;
a2 = 35; b2 = 7.5; c2 = 4;
x = (1:0.01:10)';
rand('state',0)
gdata = a1*exp(-((x-b1)/c1).^2) + a2*exp(-((x-b2)/c2).^2) ...
+ 5*(rand(size(x))-.5);
Fit the data using the two-term Gaussian library model.
ftype = fittype('gauss2');
gfit = fit(x,gdata,ftype);
Maximum number of function evaluations exceeded. Increasing
MaxFunEvals (in fit options) may allow for a better fit, or
the current equation may not be a good model for the data.
Because the Display property is set to its default value Notify, a message is
included as part of the display due to the fit not converging. The message
indicates that you should try increasing the number of function evaluations.