The following is an example of the procedure for entering file data into the program "CurvFitXYZ", polynomial form equation, using the Least Squares Option.
The file data "data_in.txt" for this example is formatted as shown below:
Z[1] n1 X[1] Y[1] X[2] Y[2] X[3] Y[3] ...... X[n1] Y[n]
Z[2] n2 X[1] Y[1] X[2] Y[2] X[3] Y[3] ...... X[n2] Y[n]
Z[3] n3 X[1] Y[1] X[2] Y[2] X[3] Y[3] ...... X[n3] Y[n]
Z[4] n4 X[1] Y[1] X[2] Y[2] X[3] Y[3] ...... X[n4] Y[n]
where "n" is defined as number of points for each curve.
Values input for this example are:
60. 9. 0. 8. 4. 10. 8. 12. 12. 9. 16. 13.
20. 15. 24. 17. 28. 16. 32. 23.
80. 9. 0. 20. 4. 18. 8. 23. 12. 20. 16. 25.
20. 22. 24. 28. 28. 27. 32. 30.
100. 9. 0. 28. 4. 32. 8. 30. 12. 35. 16. 33.
20. 38. 24. 35. 28. 40. 32. 42.
120. 9. 0. 42. 4. 40. 8. 41. 12. 43. 16. 41.
20. 45. 24. 47. 28. 50. 32. 54.
ENTER THE TYPE EQUATION YOU WISH TO CURVE FIT.
FOR POLYNOMIAL FORM, y = ax + b, INPUT 1
FOR EXPONENTIAL FORM, y = a(b)^x, LOG BASE 10, INPUT 2
FOR POWER FORM, y = a(x)^b, LOG BASE 10, INPUT 3
FOR EXPONENTIAL FORM, y = a(e)^kx, LOG BASE e, INPUT 4
ENTER TYPE ? 1
ENTER ORDER OF DETERMINANT FOR CURVE FIT SOLUTION
Example : equation (ax + b), ORDER = 2
Example : equation (ax^2 + bx + c), ORDER = 3
Example : equation (ax^3 + bx^2 + cx +d), ORDER = 4
ORDER = ? 4
IF YOU WISH TO CURVE FIT USING LEAST SQUARES OPTION,
ENTER 1
IF YOU WISH TO CURVE FIT THROUGH SPECIFIC POINTS EQUAL TO
ORDER OF DETERMINANT, ENTER 2 ? 1
INPUT NUMBER OF Z VALUES
FOR FUNCTION y = f(x) INPUT 1.
FOR FUNCTION y = f(x,z) INPUT 2 FOR LINEAR VARIATION OF z.
FOR FUNCTION y = f(x,z) INPUT 3 FOR QUADRATIC VARIATION OF z.
FOR FUNCTION y = f(x,z) INPUT 4 FOR CUBIC VARIATION OF z.
FOR FUNCTION y = f(x,z) INPUT 5 FOR QUARTIC VARIATION OF z.
NUMBER OF Z VALUES ? 4
IS LEAST SQUARES DATA INPUT FROM FILE data_in.txt ?
Input (y for yes) or (n for no) ? y
SOLUTION VALUES FOR CURVE(1) COEFFICIENTS :
coeff(1) = 8.222222e+000
coeff(2) = 4.402658e-001
coeff(3) = -2.078824-002
coeff(4) = 6.444655e-004
SOLUTION VALUES FOR CURVE(2) COEFFICIENTS :
coeff(1) = 1.942424e+001
coeff(2) = 8.216089e-002
coeff(3) = 1.007846e-002
coeff(4) = -7.891414e-005
SOLUTION VALUES FOR CURVE(3) COEFFICIENTS :
coeff(1) = 2.833333e+001
coeff(2) = 6.600830e-001
coeff(3) = -2.739448e-002
coeff(4) = 6.313131e-004
SOLUTION VALUES FOR CURVE(4) COEFFICIENTS :
coeff(1) = 4.162626e+001
coeff(2) = -2.464526e-001
coeff(3) = 1.889430e-002
coeff(4) = 2.630471e-005
IF YOU WISH TO CHECK CURVE FIT AT
ARBITRARY VALUES OF X FOR A SPECIFIC CURVE
Input 1, if not input 2 ? 1
DO YOU WISH TO INPUT VALUES OF X OR HAVE
COMPUTER SELECT VALUES AT CONSTANT INTERVAL,
Enter 1 to input x, 2 for constant interval ? 1
WHICH CURVE SERIES (1, 2, 3, 4)
SERIES NUMBER = 1
INPUT NUMBER OF X VALUES : 4
FOR X(1)
VALUE = 0
FOR X(2)
VALUE = 8
FOR X(3)
VALUE = 16
FOR X(4)
VALUE = 32
COMPUTED VALUES
X=0.0000 Y=8.2222
X=8.0000 Y=10.7439
X=16.0000 Y=12.5844
X=32.0000 Y=22.1414
IF YOU WISH TO TEST CURVE FIT AT ANOTHER X VALUE,
Input 1, if not input 2 ? 1
WHICH CURVE SERIES (1, 2, 3, 4)
SERIES NUMBER = 4
INPUT NUMBER OF X VALUES : 9
FOR X(1)
VALUE = 0
FOR X(2)
VALUE = 2
FOR X(3)
VALUE = 4
FOR X(4)
VALUE = 8
FOR X(5)
VALUE = 12
FOR X(6)
VALUE = 16
FOR X(7)
VALUE = 24
FOR X(8)
VALUE = 30
FOR X(9)
VALUE = 32
COMPUTED VALUES
X=0.0000 Y=41.6263
X=2.0000 Y=41.2091
X=4.0000 Y=40.9444
X=8.0000 Y=40.8773
X=12.0000 Y=41.4351
X=16.0000 Y=42.6277
X=24.0000 Y=46.9582
X=30.0000 Y=51.9478
X=32.0000 Y=53.9495
IF YOU WISH TO TEST CURVE FIT AT ANOTHER X VALUE,
Input 1, if not input 2 ? 2
FINAL SOLUTION VALUES FOR CONSTANT TERM(1) COEFFICIENTS :
COEFFICIENT a0 = -1.059091e+002
COEFFICIENT a1 = 3.576431+000
COEFFICIENT a2 = -3.625000e-002
COEFFICIENT a3 = 1.390993e-004
FINAL SOLUTION VALUES FOR CONSTANT TERM(2) COEFFICIENTS :
COEFFICIENT a0 = 3.133559e+001
COEFFICIENT a1 = -1.129733e+000
COEFFICIENT a2 = 1.327246e-002
COEFFICIENT a3 = -5.042676e-005
FINAL SOLUTION VALUES FOR CONSTANT TERM(3) COEFFICIENTS :
COEFFICIENT a0 = -2.044440e+000
COEFFICIENT a1 = 7.307581e-002
COEFFICIENT a2 = -8.459314e-004
COEFFICIENT a3 = 3.168779e-006
FINAL SOLUTION VALUES FOR CONSTANT TERM(4) COEFFICIENTS :
COEFFICIENT a0 = 3.890467e-002
COEFFICIENT a1 = -1.363680e-003
COEFFICIENT a2 = 1.553622e-005
COEFFICIENT a3 = -5.726755e-008
IF YOU WISH TO TEST CURVE FIT
Input 1, if not input 2 ? 1
INPUT X VALUE = 0
INPUT LOW VALUE OF Z : 60
INPUT HIGH VALUE OF Z : 120
INPUT Z INTERVAL : 20
For X-VALUE = 0.000000
COMPUTED VALUES
Z=6.000000e+001 Y=8.222222e+000
Z=8.000000e+001 Y=1.942424e+001
Z=1.000000e+002 Y=3.833333e+001
Z=1.200000e+002 Y=4.162626e+001
INPUT ANOTHER X VALUE (yes = 1) (no = 2) ? 2
Coefficient data are output in file (coeff_out).
X versus Y results of curve fit are output in file (xy_out).
END OF PROGRAM, ENTER ANY CHARACTER TO EXIT : 1
A copy of the coefficient data output file (coeff_out) is
listed below:
-1.059091e+002, 3.576431e+000, -3.625000e-002, 1.390993e-004, 3.133559e+001,
-1.129733e+000, 1.327246e-002, -5.042676ee-005, -2.044440e+000, 7.307581e-002,
-8.459314e-004, 3.168779e-006, 3.890467ee-002, -1.363680e-003, 1.553622e-005,
-5.726755e-008,
The results of the curve fit data requested for Curve 1 and Curve 4
for this example located in output file (xy_out) listed below:
6.000000e+001,
0.000000e+000, 8.222222e+000,
8.000000e+000, 1.074387e+001,
1.600000e+001, 1.258442e+001,
3.200000e+001, 2.214141e+001,
1.200000e+002,
0.000000e+000, 4.162626e+001,
2.000000e+000, 4.120915e+001,
4.000000e+000, 4.094444e+001,
8.000000e+000, 4.087734e+001,
1.200000e+001, 4.143506e+001,
1.600000e+001, 4.262771e+001,
2.400000e+001, 4.695815e+001,
3.000000e+001, 5.194778e+001,
3.200000e+001, 5.394949e+001,
These data may be copied to a spreadsheet program with plotting
capability, to view the curve fit results for Curves 1 and 4.