% aidsrun.m clear all, close all % Input aids data logistic model. load aids tvec = aids.year(1:12); yvec = aids.cases(1:12); nlin_fn = @logistic; b=[260 47572 1]'; %b=[106618 42514 0.1]'; nparams = length(b); % First run the optimzation routine [b_opt,r,J,CovDelta_b,mse] = nlinfit(tvec,yvec,@logistic,b); model_opt = feval(nlin_fn,b_opt,tvec); figure(1) plot(tvec,yvec,'o',tvec,model_opt,'*') legend('data','model')