Four Curve Fits for the HP-34C

Back to main page
I've had a lot of visitors but few comments! Let me hear from you! Email me at: Genewright143@hotmail.com

This program originally appeared in the January 1980 PPC Journal V7N1 by Charles Hooper. Thanks to Charles wherever he is today! This program uses the HP-34C's built-in linear regression for fitting straight lines and adds the possibilities of exponential, logarithmic, and power curve fits.

Instructions: 1) Clear registers. f REG. 2) Key data to be entered as X ENTER Y and press A. Display shows the number of data points entered. 3) If you make a mistake in step 2, immediately re-enter the incorrect pair and press R/S. Display will show one less data point entered. 4) Turn the machine off then back on to initialize flags. This will set the machine to linear regression status. 5) For exponential curve fits, press GSB 1. Display will show a 1. 6) For logarithmic curve fits, press GSB 2. Display will show a 2. 7) For power curve fits, press GSB 3. Display will show a 3. 8) Determine the "goodness" of fit by calculating the correlation coefficient. Press h r. Display shows the correlation. (My statistics teachers would say square this number to show the total variation explained by the model, but then again, I'm not in school any longer). 9) Extrapolate points using the equation by entering X and pressing the B key. Display shows the projected Y value.

To try a different model, turn the calculator off then on again and go to step 5, 6, or 7 above.

Program listing. A few notes about the program listing below. The little f, g, and h's that are scattered throughout the listing are the three shift keys on the HP-34C. Note as well the period's after STO's and RCL's. They are intentionally there. These access memories above 0-9. Most everything else should be explanatory.
Line    Instruction
01	h LBL 0
02	h SF 0
03	h LBL A
04	STO I
05	f LN
06	GSB 4
07	STO+ 8
08	g X^2
09	GSB 4
10	STO+ 9
11	X <> Y
12	STO. 3
13	f LN
14	GSB 4
15	STO+ 6
16	g X^2
17	GSB 4
18	STO+ 7
19	RCL. 1
20	RCL I
21	h LASTX
22	*
23	+
24	STO. 1
25	RCL. 2
26	RCL I
27	f LN
28	RCL. 3
29	*
30	GSB 4
31	+
32	STO. 2
33	RCL. 0
34	RCL. 3
35	f LN
36	RCL I
37	f LN
38	*
39	GSB 4
40	+
41	STO. 0
42	RCL I
43	RCL. 3
44	h F? 0
45	GTO 5
46	f SIGMA+
47	h RTN
48	h LBL 4
49	h F? 0
50	CHS
51	h RTN
52	h LBL 5
53	f SIGMA-
54	h CF 0
55	h RTN
56	h LBL B
57	h F? 2
58	f LN
59	h Y-HAT
60	h F? 1
61	f LN
62	h RTN
63	h LBL 3
64	GSB 1
65	GSB 2
66	RCL. 0
67	RCL. 2
68	STO. 0
69	CLX
70	RCL 5
71	STO 1
72	X <> Y
73	STO 5
74	3
75	RTN
76	h LBL 2
77	h SF 2
78	RCL 6
79	RCL 1
80	STO 6
81	X <> Y
82	STO 1
83	RCL 7
84	RCL 2
85	STO 7
86	X <> Y
87	STO 2
88	RCL. 1
89	RCL 5
90	STO. 1
91	X <> Y
92	STO 5
93	2
94	h RTN
95	h LBL 1
96	h SF 1
97	RCL 3
98	RCL 8
99	STO 3
100	X <> Y
101	STO 8
102	RCL 4
103	RCL 9
104	STO 4
105	X <> Y
106	STO 9
107	RCL. 2
108	RCL 5
109	STO. 2
110	X <> Y
111	STO 5
112	1
113	h RTN

Visitors since 6/12/97