Curve Fitting using the TI-92


Step 1: Enter data.

To make use of the curve fitting routines built into the TI-92, we first must enter the data. This can be done directly using the Data/Matrix Editor. To access this editor, use the APPS key (left and down from the cursor control). This causes a menu to drop down with item 6 being the Data/Matrix Editor. Selecting this item either by moving down to it or pressing the 6 key causes a sub-menu to open containing the options 1:Current¼ , 2:Open¼ , 3:New¼ . Since we are starting fresh, select the 3:New item. The dialog box that is then displayed allows you to select the type, the folder where the data is to be stored, and the name (variable) to use for storing the data. This takes you to the data screen where you can begin to input the data.

Example: To enter the data in Table I on page 76 of Stewart’s Calculus, I entered the name tbl1p76 as the name of the variable (or file).

For column 1, we want the even years from 1972 through 1990. We could type them in, hitting the ENTER button each time to move to the next cell, or we can have the calculator do it for us by using the F4 Header key. The formula seq(x,x,1972,1990,2) will do the job. In general, the syntax for this formula is seq(formula, loop variable, start, stop, step).

The data in column 2 must be typed in, hitting the ENTER key each time to record the value and move to the next cell.

It is nice to put Titles at the top of the columns to remember what the numbers represent. To do this, use the cursor control to move to the top of the column and type the heading. For c1, I entered year, and for c2 I used CO2. The data screen now looks something like this.

DATA Year CO2        
  c1 c2 c3 c4 c5 c6
1 1972 327.30        
2 1974 330        
3 1976 332        
4 1978 335.30        
5 1980 338.50        
6 1982 341        
7 1984 344.3        

Step 2: Define plot.

We can plot the points (x,y) we have inputted where x is the value in c1 and y is the value in c2. To do this, we use the F2 Plot Setup key. This opens a dialog box containing a listing of the defined plots. If there are already plots defined you should either turn them off (i.e. keep them from being plotted) using the F4 key, or clear them (F3 clears all). I will assume that we want to use Plot 1 for plotting the above data. Be sure it is highlighted and press the F1 Define key. The Plot Type we want is Scatter. The Mark set to Box is fine, or you can select another symbol to use. For x, type in c1 then ENTER. For y type in c2 and ENTER. Use the cursor control to move down the list. Hit the ENTER key to close the define box and return to the first dialog box. The entry in Plot 1 should be checked and there should be added information on the line. Hit the ENTER key again to exit this box.

Next we want to change the window so that all our points will appear when plotted. This is done as before using the green-diamond key then WINDOW. One set of acceptable values are xmin= 1972, xmax= 1990, xscl= 1, ymin= 325, ymax= 355, yscl=1.

Now move to the graph screen and observe the points being plotted.

Step 3: Linear Regression

To use the linear regression routine built into the TI-92 to find the line that "best fits" the data using the least-squares method, move back to the Data/Matrix editor by APPS/ 6: Data/Matrix Editor/ 1:Current, ENTER. This should cause the table entered above to appear on your screen. The F5 Calc key gives a dialog box. The list of built in curve fitting routines is found under Calculation Type. The one we want first is the 5:LinReg. Define x to be c1 by moving down to that cell and typing c1. Define y as c2. Store RegEQ to y1(x). Hit the ENTER key to have the calculations done. The results are displayed in a dialog box. It should look something like this.

y=a× x+b
a =1.496667
b =-2624.826667
corr =.998275
R2 =.996552

Moving to the GRAPH screen shows a plot of the original data and the line that was obtained. In this case, the fit is excellent, although it does not always have to be so. The equation of the line can be retrieved by using the Y= screen and noting the definition of the y1 variable.

Other routines:

There are several other curve fitting routines that may work if the linear fit is not very good. To do Example 2 on page 79, define the data and use the 4:ExpReg routine instead of the 5:LinReg above. This finds an exponential function that "best fits" the data by doing a linear regression on c1 and ln(c2). The exponential function does not fit the data well, although it fits better than a line would. However if you try the 3:CubicReg routine, a cubic function will be found which fits the data even better.

NOTE: There is a lot more to curve fitting than what is done here. Be careful and realize that you only have the very beginning of a complicated topic.

Created by T. J. Sanders, tjs@usna.edu