Hello,
I want to fit quadratic equation curves to pumps' characteristics, but I dont want to use linear equation solver, and I want to use only my 32SII. And I dont want to store the points' coordinates.
############################################
# #
# What do you think about this method??? #
# #
############################################Let y=A*x^2+B*x+C, the derivative is:
y'=2*A*x+B == m*x+b, so A=m/2, and B=b.And if we minimize the sum of calculated and given y's
differece's square, we give C=AVER(y)-A*AVER(x^2)-B*AVER(x).
AVER() is average function.Here is the 32SII version:
LBL S #First start
CLSum
INPUT X
STO I
STO U
x^2
STO K
INPUT Y
STO J
STO V
LBL I #Input more points
INPUT X
ENTER
STO+I
x^2
STO+K
Roll Down
RCL-U
INPUT Y
STO+J
RCL-V
/
1/x #End of numerical differentiation
RCL X
RCL+U
2
/
Sum+
RCL X
STO U
RCL Y
STO V
n
1
+
STO N
VIEW N
GTO ILBL C #Calculating A, B and C
m
2
/
STO A
VIEW A
b
STO B
VIEW B
RCL J
RCL A
RCL*K
-
RCL B
RCL*I
-
RCL/N
STO C
VIEW C
RTNLBL S: CK=BE1E 15.0
LBL I: CK=D9ED 42.0
LBL C: CK=C868 30.0Variables:
A, B, C: Coefficients
X, Y: New point coordinates
U, V: Old point coordinates
I: SumX
J: SumY
K: SumX^2
N: Number of datapoints
And statistic registersUsage:
1., Sort the datapoints in increasing order of X
2., Start program with XEQ S
3., Enter the datapoints (No correction available!)
4., If you entered the last data, and you see N=... screen
start the coefficient-calculator routine: XEQ C=====================================================
An example:-----------------------------------------------------
MEASURED CALCULATED
Q H H_Excel H_HP32SII Delta%_HP32SII
(flow) (head)
[m3/h] [m] [m] [m] [%]
-----------------------------------------------------
0 90.0 90.0 90.0 0
30 90.2 90.2 90.2 -0.02
60 86.4 86.5 86.5 +0.13
90 79.0 79.0 79.0 -0.01
120 67.7 67.6 67.6 -0.12
150 52.4 52.4 52.4 0
-----------------------------------------------------And the coefficients:
Excel HP32SII
A -2.133E-3 -2.139E-3
B +6.956E-2 +7.017E-2
C +9.000E+1 +9.000E+1
Enjoy! :D
Csaba
Edited: 28 June 2004, 3:26 a.m.