function [fitresult, gof, x, y] = createFit(num_feats, mean_r,varargin)
%CREATEFIT(NUM_FEATS,MEAN_R)
%  Create a fit.
%
%  Data for 'untitled fit 1' fit:
%      X Input : num_feats
%      Y Output: mean_r
%  Output:
%      fitresult : a fit object representing the fit.
%      gof : structure with goodness-of fit info.
%
%  See also FIT, CFIT, SFIT.

%  Auto-generated by MATLAB on 09-Jan-2018 14:30:55


%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( num_feats, mean_r );

% Set up fittype and options.
ft = fittype( '(1-b*exp(-a*x))+c', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Lower = [0 -Inf -Inf];
opts.StartPoint = [0.0358727641861837 0.448641991059645 0.835416899160867];
opts.Upper = [1 Inf Inf];

% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );

% % Plot fit with data.
hold on;
h = plot( fitresult, xData, yData);
 set(gca,'XScale','log')
 set(h,varargin{:})
 x=h(2).XData;y=h(2).YData;
% legend( h, 'mean_r vs. num_feats', 'untitled fit 1', 'Location', 'NorthEast' );
% Label axes
% xlabel num_feats
% ylabel mean_r
% grid on
clf;

