xdata = [1 1.01 1.12 1.24 1.39 1.61 1.89 2.17 2.42 3.01 3.58 4.03 4.76 5.36 5.76 6.16 6.40 6.62 6.87 7.05 7.16 7.27 7.43 7.50 7.61];
ydata = [0 0.03 0.14 0.23 0.32 0.41 0.50 0.58 0.67 0.85 1.04 1.21 1.58 1.94 2.29 2.67 3.02 3.39 3.75 4.12 4.47 4.85 5.21 5.57 6.30];
gent_function = @(x,xdata)(x(1)*x(2)*(xdata.^3 - 1))./((xdata).*(xdata*x(2) - xdata.^3 + 3*xdata - 2));
x = lsqcurvefit(gent_function,x0,xdata,ydata);
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
times = linspace(xdata(1),xdata(end));
plot(xdata,ydata,'ko',times,gent_function(x,times),'b-')
legend('Data','Fitted Exponential')
title('Data and Fitted Curve')
Best Answer