% Script: Logistic Example

% Now, go ahead and solve the problem with many different random starting 
% points.
%
fcn = 'logisticfn';
fcnjac = 'logisticfnjac';
disp('Now we solve the problem with many different random starting points:')
starts = [ 'fill in your choices'];
N = size(starts,2);
models=zeros(3,N);
chisqvals=zeros(N,1);
normg=zeros(N,1);
itercnts=zeros(N,1);
for i=1:N
  p0=starts(:,i);
  [pest,itercnts(i)]=lm(fcn,fcnjac,p0,1.0e-14,500);
  models(:,i)=pest;
  chisqvals(i)=norm(feval(fcn,pest))^2;
  normg(i)=norm(feval(fcnjac,pest)'*feval(fcn,pest));
end
%
disp('Model Solutions:')
models
myP = [
000  5.835;
010  6.013;
020  6.048;
030  6.008;
040  6.013;
050  6.253;
060  6.665;
070  7.124;
080  7.581;
090  8.216;
100  9.168;
111  10.164;
121  12.000;
131  13.896;
141  15.914;
151  17.928;
161  20.066;
171  22.712;
181  25.974;
191  29.003;
201  32.612;
211  36.136;
221  37.932;
231  39.988;
241  41.748;
251  43.815;
261  46.196;
271  49.152;
281  49.634;
291  51.099;
301  52.085];


