I'm trying to use Nonlinear Data-Fitting and lsqnonlin in Matlab to find parameter (a) of my equation. The code doesn't have any error but the plot which Matlab is suggesting, starts at a different initial value than the points I have so I can't find the correct value for the parameter (a).
This is my code. Can you help me find the plot which is fitted to my points and the correct value for parameter (a)?
x = [0, 24, 48, 72, 96];
y = [0.16 * 10^8, 0.18 * 10^8, 0.35 * 10^8, 0.62 * 10^8, 1.41 * 10^8];
plot(x,y);
a = optimvar('a', 1);
x0.a = [0];
diffun = 10^10 * exp(-exp(-a*x));
diffexpr = sum((diffun - y).^2);
ssqprob = optimproblem('Objective',diffexpr);
[sol,fval,exitflag,output] = solve(ssqprob,x0);
resp = evaluate(diffun,sol);
hold on
plot(x,resp)
hold off