When in doubt, simulate:
p = [2 5]; X = 0:20; Yfcn = @(p,X) 1./(1+exp(-p(1).*(X-p(2)))); Y = Yfcn(p,X) + 0.1*randn(size(X)); [par fit]=fminsearch(@(p) norm(1./(1+exp(-p(1).*(X-p(2)))) -Y), [1,1])
figure(1) plot(X, Y, 'p') hold on plot(X, Yfcn(par,X), '-r') hold off grid
It looks good to me, and the parameter estimates are appropriate. If you are not getting reasonable results, experiment with different initial parameter estimates.