function [fitresult, gof] = createFit(doseB, y, clr)
%CREATEFIT1(DOSEB,Y)
% Create a fit.
%
% Data for 'untitled fit 1' fit:
% X Input : doseB
% Y Output: y
% 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 21-May-2012 10:57:07
% Copyright 2011 - 2012 MathWorks, Inc.
%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( doseB, y );
% Set up fittype and options.
ft = fittype( 'y0 + Emax*x^n/(EC50^n + x^n)', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( ft );
opts.Display = 'Off';
opts.Lower = [0 0 0 0];
opts.StartPoint = [0.2 0.55 0.66 0.939213156370957];
opts.Upper = [Inf Inf Inf Inf];
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
gcf ;
hold on
xPlot = linspace(xData(1),xData(end), 100) ;
h = plot(xPlot, fitresult(xPlot));
% h1 = scatter(xData, yData) ;
set(h, 'Color', clr)
drawnow
box on;
hold off