120 FORMATC ' ,I6,10X,I4,6X,3(4X,F10.4)) 

 C 



C ZERO OUT MATRIX TERMS 

 C 



150 A1=0.0 



81=0.0 



01=0.0 



E 1=0.0 



G1=0.0 

 C 



C COMPUTE TERMS FOR LEAST SQUARES MATRIX CONSTRUCTION 



C 



DO 200 1=1, N 



PARTA=F1(X(I),A0,B0) 



PARTB=F2(X(I),A0,B0) 



P0WF=F3(X(I),A0,B0) 



A1=A1+(PARTA**2) 

 B1=B1+(PARTA*PARTB) 



01=01+ (PARTB**2) 



E1=E1+(PARTA*(Y(I)-P0WF)) 

 200 G1=G1+(PARTB*(Y(I)-P0WF)) 



C1=B1 

 C 



C COMPUTE CORRECTION TERMS FOR A AND B 



C 



DIVS0R=(A1*D1-B1*C1) 



AC0RR=(D1*E1-B1*61)/DIVS0R 



BC0RR=(A1*GX-C1*E1)/DIVS0R 

 C 



C CREATE NEW A AND B 

 C 



230 A=AO+ACORR 



B=BO+BCORR/AO 

 C 



C COMPUTE NEW SUM OF SQUARES OF RESIDUALS WITH NEW ESTIMATES 

 C 



PNEW=0.0 



DO 250 1=1, N 

 250 PNEW=PNEW+((Y(I)-F3(X(I),A,B))**2) 

 C 



C TEST FOR CONVERGENT SOLUTION (PNEW < POLO) 

 C IF NOT, BISECT CORRECTIONS AND RECOMPUTE 

 C 



IF(PNEW.LT.POLD) GO TO 300 



AC0RR=.5*AC0RR 

 BC0RR=.5*BC0RR 



NBIS=NBIS+1 

 IF(NBIS.GT.IO) GO TO 300 



GO TO 230 

 C 



C TEST FOR MINIMUM CHANGE OF A AND B 

 C 



300 IF(ABS(A-AO).GT.AMIN) GO TO 500 



133 



