2120 LOCATE4,1,0:PRINT" CURVE FITTER":PRINT" ------------":PRINT:PRINT" 1. LOAD/MODIFY Data ":PRINT:PRINT" 2. SET/CHANGE Plotting INTERVAL & LABELS for the graph":PRINT
2340 PRINT" 3. View EQUATIONS, CORRELATION COEFFICIENTS and FIT CURVE ":PRINT:PRINT" 4. VIEW GRAPH of Data Points":PRINT:PRINT" 5. EXIT to DOS ":PRINT:GOSUB30000:PRINT
2500 LOCATE22,12:PRINT"Please Make a Choice ":A$=INKEY$:PICK=VAL(A$):IFINT(PICK)<>PICKTHENLOCATE22,32:PRINTSTRING$(10,32);:GOTO2500
4080 CLS:LOCATE5,1:PRINT" Choose One of the Following Curves":PRINT" -----------------------------------------------":PRINT:PRINT" 1. LINEAR Regression: Y = a + bX":PRINT
4220 PRINT" 2. EXPONENTIAL Regression: Y = a(b^X)":PRINT:PRINT" 3. SECOND ORDER Regression: Y = a + bX + c(X^2)":PRINT:PRINT" 4. LOGARITHMIC Regression: Y = a + b lnX":PRINT
4340 PRINT" 5. POWER Regression: Y = a(X^b)":PRINT:GOSUB30000
5100 FLAGDATA=1:CLS:LOCATE1,15:PRINT"DATA INPUT AND MODIFICATION":LOCATE2,15:PRINT"---------------------------":PRINT:PRINT:PRINT"READ DATA FROM A DISK FILE (1) OR TYPE IN DATA (2)":PRINT
5240 A$=INKEY$:IFA$=""THEN5240
5260 RD=VAL(A$):IF RD=1 THEN GOSUB 18020:PG%=1:RETURN
5300 IFRD<>2THEN5060
5340 PRINT:INPUT"HOW MANY X,Y PAIRS OF DATA DO YOU WISH TO ENTER";COUNT:IFCOUNT<3THENPRINT"Please Input at Least 3 Points":GOTO5340
5380 IFINT(COUNT)<>COUNTTHENCLS:GOTO5340
5400 IFCOUNT>60THENPRINT"There must be between 3 and 60 Points ":GOTO5340
5420 DIMA(COUNT):DIMB(COUNT):DIMX(COUNT):DIMY(COUNT):FILENAME$="NONE":CLS:LOCATE1,3:PRINT"N","X VALUE","Y VALUE":PRINTSTRING$(40,42);:PRINT" DATA ENTRY ROUTINE":J=5:FORI=1TOCOUNT
9000 LOCATE24,1:PRINT"WOULD YOU LIKE TO CHANGE THE PLOTTING INTERVAL (Y/N)?";
9100 A$=INKEY$:IFA$=""THEN9100
9120 IFA$="n"ORA$="N"THENRETURN
9140 IFFLAGDATA=0THEN24400
9160 FLAGINTERVAL=1
9180 CLS:LOCATE 2,1:PRINT"X HAS A MINIMUM VALUE OF ";LOW:PRINT"X HAS A MAXIMUM VALUE OF ";HIGH:PRINT:PRINT"Y HAS A MINIMUM VALUE OF ";MIN:PRINT"Y HAS A MAXIMUM VALUE OF ";MAX
9380 INPUT"WHAT IS THE MINIMUM VALUE TO PLOT ON THE X-AXIS";NLOW:INPUT"WHAT IS THE MAXIMUM VALUE TO PLOT ON THE X-AXIS";NHIGH:PRINT:INPUT"WHAT IS THE MINIMUM VALUE TO PLOT ON THE Y-AXIS";NMIN:INPUT"WHAT IS THE MAXIMUM VALUE TO PLOT ON THE Y-AXIS";NMAX
9480 IF NLOW<>0 THEN LOW=NMIN:FLAGSTAT=0
9520 IF NHIGH<>0 THEN HIGH=NHIGH:FLAGSTAT=0
9530 IF NMIN<>O THEN MIN=NMIN:FLAGSTAT=0
9540 IF NMAX<>0 THEN MAX=NMAX:FLAGSTAT =0
9640 PRINT:INPUT"DO YOU WANT TO SAVE NEW INTERVALS - ENTER Y OR N ";A$:IF A$="N"OR A$="n"THEN 9720 CLS
12460 CLS:PRINT"WOULD YOU LIKE TO REVIEW THE GRAPH (Y/N)";
12540 A$=INKEY$:IFA$=""THEN12540
12560 IFA$="Y"ORA$="y"THENSCREEN2:GOSUB10320
12580 RETURN
13100 LOCATE24,1:PRINT"PRESS ANY KEY TO CONTINUE";
13120 A$=INKEY$:IFA$=""THEN13120
13140 RETURN
13160 CLS:LOCATE5,34:PRINT"CURVE FITTER":LOCATE8,26:PRINT"Copyright 1984 Scott Camazine":LOCATE20,23:PRINT"Press [F2] to RUN the Program Again":LOCATE22,23:PRINT" Or [ESC] to Return to DOS
13300 A$=INKEY$:IFA$=""THEN13300
13320 IFA$=CHR$(27)THENSYSTEM ELSERUN
13340 END
14000 CLS:LOCATE2,10:PRINT"CURRENT VALUES FOR AXIS LABELS":LOCATE3,10:PRINT"----------------------------------------------------":COLOR0,7:LOCATE5,1:PRINT" TITLE OF GRAPH: ";:COLOR7,0:PRINT" ";TITLE$
14180 COLOR0,7:LOCATE7,1:PRINT" LABEL FOR X AXIS: ";:COLOR7,0:PRINT" ";XAXIS$:COLOR0,7:LOCATE9,1:PRINT" LABEL FOR Y AXIS: ";:COLOR7,0:PRINT" ";YAXIS$:LOCATE12,1:PRINT"Would You Like to CHANGE the TITLE or LABELS for the Graph (Y/N)?
14260 A$=INKEY$:IFA$=""THEN14260
14280 IFA$="N"ORA$="n"THENCLS:RETURN
14380 LOCATE 14,1:PRINT"ENTER THE TITLE FOR THE GRAPH":LOCATE 15,1:PRINT STRING$(55,254):LOCATE 15,1
14540 INPUT NTITLE$:IF NTITLE$<>"" THEN TITLE$=NTITLE$
14880 LOCATE 17,1:PRINT"ENTER THE LABEL FOR THE X AXIS":LOCATE 18,1:PRINT STRING$(20,254):LOCATE 18,1
15080 INPUT NXAXIS$:IF NXAXIS$<>"" THEN XAXIS$=NXAXIS$
15420 LOCATE 20,1:PRINT"ENTER THE TITLE FOR THE Y AXIS":LOCATE 21,1:PRINT STRING$(20,254):LOCATE 21,1
15680 INPUT NYAXIS$:IF NYAXIS$<>"" THEN YAXIS$=NYAXIS$
16000 LOCATE 21,1:INPUT "DO YOU WANT TO SAVE NEW LABELS/TITLES? (Y/N) ";A$
17060 CLS:LOCATE 1,1:PRINT"DATA FILE: ";FILENAME$;" ";COUNT;" data points ";"PAGE: ";PG%:LOCATE 3,1:PRINT"N","X VALUE","Y VALUE":PRINT STRING$(50,42):J=5:FOR I=PS%TO ED%:IF I>COUNT THEN 17480
17200 LOCATE J,2:PRINT I:LOCATE J,15:PRINT X(I):LOCATE J,29:PRINT Y(I):J=J+1:NEXT I
17480 RETURN
17520 IF FLAGDATA=0 THEN 24400
17560 CLS:XMIN=LOW:XMAX=HIGH:YMIN=MIN:YMAX=MAX:CLS:LOCATE 2,10:PRINT"CURRENT VALUES FOR PLOTTING INTERVAL AND AXIS LABELS":LOCATE 3,10:PRINT"----------------------------------------------------
17680 COLOR0,7:LOCATE5,1:PRINT" TITLE OF GRAPH: ";:COLOR7,0:PRINT" ";TITLE$:COLOR0,7:LOCATE7,1:PRINT" LABEL FOR X AXIS: ";:COLOR7,0:PRINT" ";XAXIS$:COLOR0,7:LOCATE9,1:PRINT" LABEL FOR Y AXIS: ";:COLOR7,0:PRINT" ";YAXIS$
17740 LOCATE 12,1:PRINT"PLOTTING INTERVAL FOR X AXIS: ";LOW;" to ";HIGH:LOCATE 14,1:PRINT"PLOTTING INTERVAL FOR Y AXIS: ";MIN;" to ";MAX:GOSUB 13100:RETURN
18020 INPUT"WHAT DATA FILE WOULD YOU LIKE";FILENAME$:CLS:OPEN FILENAME$ FOR INPUT AS #1:DIMX(1000):DIMY(1000):INPUT#1,TITLE$,XAXIS$,YAXIS$,LOW,HIGH,MIN,MAX:I=0
19000 LOCATE 21,1:PRINT STRING$(70,32):LOCATE 22,1:PRINT STRING$(70,32):LOCATE 21,1:PRINT:INPUT"WHAT NAME WOULD YOU LIKE FOR THE DATA FILE";DATAFILE$:OPEN DATAFILE$ FOR OUTPUT AS #2:WRITE#2,TITLE$,XAXIS$,YAXIS$,LOW,HIGH,MIN,MAX:I=1:FOR I=1 TO COUNT
22000 LOCATE21,1:PRINTSTRING$(70,32):LOCATE21,1:PRINT"WOULD YOU LIKE TO CHANGE ANY OF THE VALUES (Y/N)?";:LOCATE22,1:PRINTCHR$(27);" TO GO BACK A PAGE, ";CHR$(26);" TO GO FORWARD
22080 A$=INKEY$:IFA$=""THEN22080
22100 IFA$="Y"ORA$="y"THEN22120
22103 IF LEN(A$)=2 AND ASC(RIGHT$(A$,1))=75 AND PS%<>1 THEN PG%=PG%-1:GOSUB 17000:GOTO 22000
22107 IF LEN(A$)=2 AND ASC(RIGHT$(A$,1))=77 AND ED%<>COUNT THEN PG%=PG%+1:GOSUB 17000:GOTO 22000
22110 IF A$="N"OR A$="n"THEN 22310
22115 BEEP:BEEP:GOTO22000
22120 LOCATE21,1:PRINTSTRING$(70,32):LOCATE22,1:PRINTSTRING$(70,32):LOCATE21,1:A$="":PRINT"(C)HANGE, (D)ELETE, or (A)DD ? ";A$
22310 LOCATE21,1:PRINTSTRING$(70,32):LOCATE22,1:PRINTSTRING$(70,32):LOCATE21,1:PRINT"WOULD YOU LIKE TO SAVE THE DATA ON DISK? (Y/N)
22313 A$=INKEY$:IFA$=""GOTO22313
22314 IFA$="Y"ORA$="y"THENGOSUB19000:RETURN
22315 RETURN
22320 LOCATE21,1:INPUT"WHAT IS THE SUBSCRIPT (N) OF THE DATA POINT YOU WISH TO CHANGE ";PJ%:IFPJ%<1ORPJ%>COUNTTHENLOCATE22,1:PRINTSTRING$(78,32);:GOTO22000
24000 CLS:LOCATE10,1:PRINT"THE CALCULATION OF CERTAIN OF THESE CURVES INVOLVES TAKING ":PRINT" THE LOGARITHM OF THE X AND/OR Y VALUES ":PRINT:PRINT"YOU CANNOT TAKE THE LOGARITHM OF A NON-POSITIVE NUMBER":PRINT
24160 PRINT"THEREFORE NEGATIVE OR ZERO VALUES OF X ARE NOT ALLOWED FOR THE":PRINT" LOGARITHMIC CURVE FITTING ROUTINE ":PRINT"ALSO NEGATIVE OR ZERO VALUES OF Y ARE NOT ALLOWED FOR THE ":PRINT" EXPONENTIAL CURVE FITTING ROUTINE
24240 PRINT"FOR THE POWER CURVE BOTH X AND Y MUST BE POSITIVE":PRINT:PRINT"THESE NON-POSITIVE VALUES HAVE BEEN ELIMINATED FROM THE ":PRINT" CALCULATIONS, BUT WILL BE PLOTTED ON THE SCREEN":FORP=1TO4000:NEXTP:FLAGMESSAGE=1:LOCATE3,13:RETURN
24400 CLS:BEEP:LOCATE10,1:PRINT"You Must Enter the Data Before Proceeding with Other Options":FORK=1TO3000:NEXTK:CLS:RETURN820
24600 CLS:BEEP:LOCATE10,1:PRINT"You Must Choose the Other Options Before Printing the Equations":FORK=1TO3000:NEXTK:CLS:RETURN820
60000 LOCATE 12,30:BEEP:IF ERR=53 THEN PRINT"FILE NOT FOUND.......Please Try Again":FOR K=1 TO 3000:NEXT:CLS:PG%=1:RESUME 820
60100 IF ERR=6 THEN PRINT"In this Interval an OVERFLOW error has occured":PRINT"Choose Another Plotting Interval":FOR K=1 TO 3000:NEXT:CLS:RESUME 9180
60120 IF ERR=11 THEN PRINT"In this Interval a DIVISION BY ZERO error has occured":PRINT"Choose Another Plotting Interval":FOR K=1 TO 3000:NEXT:CLS:RESUME 9180
60140 IF ERR=71 THEN PRINT"DISK DRIVE NOT READY":GOSUB 13100:CLS:RESUME 18020
60160 IF ERR=52 OR ERR=76 THEN PRINT"File name missing or Drive invalid ":GOSUB 13100:CLS:PG%=1:RESUME 18020