Appendix A. 3 



SUBROUTINE POWFIT(A,B,X,Y,N,AMIN,BMIN,ILIST) 

 C 



C THIS ROUTINE PERFORMS A BEST FIT TO DATA WITH A POWER LAW 

 C FUNCTION OF THE FORM Y=A*X**B USING AN ITERATIVE METHOD 

 C AS DESCRIBED IN SCARB0R0UGH(1930), ART. 115. 

 C INPUTS ARE 

 C A=COEFFICIENT OF X 

 C B= EXPONENT OF X 



C X= ARRAY OF INDEPENDENT VARIABLE VALUES 

 C Y= ARRAY OF DEPENDENT VARIABLE VALUES 

 C N= NUMBER OF DATA PAIRS OF X AND Y 



C AMIN= MINIMUM VALUE FOR A CORRECTION TO STOP ITERATION 

 C BMIN= MINIMUM VALUE FOR B CORRECTION TO STOP ITERATION 

 C ILIST= 1 FOR SUMMARY OF ITERATION PROCESS, = , NO LISTING 

 C PROGRAMMED BY C.G. FOX-ADVANCED TECHNOLOGY STAFF, NAVOCEANO, 4/15/83 

 C 



DIMENSION X(10),Y(10) 

 C 



C COMPUTE INITIAL ESTIMATE OF A AND B BY PERFORMING A SIMPLE 

 C LINEAR FIT ON LOG TRANSFORMED DATA 

 C 



XN=FLOAT(N) 



XPROD=0.0 



XSUM=0.0 



YSUM=0.0 



XSQR=0.0 

 C WRITE(6,'(2F10.4)') (X(I),Y(I),I=1,N) 



DO 50 J=1,N 



IF(Y(J).EQ.O.O) GO TO 50 



YTEMP=AL0G10(Y(J)) 



XTEMP=AL0G10(X(J)) 



XPR0D=XPR0D+(YTEMP*XTEMP) 



XSUM=XSUM+XTEMP 



YSUM=YSUM+YTEMP 

 50 XSQR=XSQR+(XTEMP*XTEMP) 



BO=((XN*XPROD)-(XSUM*YSUM))/((XN*XSQR)-(XSUM*XSUM)) 



AO={YSUM/XN)-(BO*(XSUM/XN)) 



A0=10.**A0 

 C 



C COMPUTE SUM OF SQUARES OF THE RESIDUALS 

 C 



POLD=0.0 



DO 100 I=1,N 

 100 P0LD=P0LD+(( Y( I )-F3(X( I ) ,AO,BO) )**2) 



ITERATED 



NBIS=0 



IF(ILIST.EQ.1)WRITE(6,110) 

 110 FORMATC ITERATION # OF BISECTIONS A 8 

 *RESIDUALS**2') 



IF(ILIST.EQ.1)WRITE(6,120)ITERAT,NBIS,A0,B0,P0LD 



132 



