## Curve Fit & Function Plot

### Introduction

Often, we are faced with the task of finding the relationship between two sets of numbers, so that interpolation and extrapolation can be done. Many laboratory experiments are sources for huge amounts of numbers in which, if possible, should be replaced and represented by an "easier to read" function. Measurements of physical properties such as viscosity, density, vapor pressure or thermal conductivity are examples of such data sources. If there is enough data information to find the relationship between X and Y, interpolation and extrapolation is possible. The relationship was, in fact in earlier times, often found by plotting data on various graphs i.e. linear or log-log to see which one gave the best fit.
To help determine how good the fit is for the curve selected, the SSE (Sum of Squares Error) and the coefficient of fit performance (r2) are reported. The best fit usually have the smallest SSE and a coefficient of performance near 1.000. The curve is automatically refitted anytime Calculate push button is used or a change in a curve type occurs.
Fitting functions to empirical data are not always a straight forward procedure. Two functions may have an approximately equal coefficient of performance. If so, as a rule, the simplest function of these should be selected.

CHEMIX School - Curve fit function plot ### Starting a New Data Set

To fit a curve to a new data set, just remove the content (if any) in Data (X Y) edit field and insert your data.
Numeric data must be separated by one or more spaces.
Examples of legal numbers are: -1.234, -1.234E-4, 1.234, 1.234E4
The Curve Fit tool in CHEMIX allows you to define a data set title, assign axis titles and select a curve type. The Edit list box push buttons allows you to save, replace and delete your X Y data sets.

To load a previously saved data set, double click one of the elements in the Name (X Y data) list box. The application reads the data from a file and displays it in the Data (X Y) text field.

### Saving Data

Once you have entered a data set, enter a data title in the Name (X Y data) edit field and save your data using one of the push buttons in the Insert frame (Before or After) in Edit list box

### Function, r2 and SSE

Function: Function in which represent the output curve.
r2 The goodness of the fit - 1.0 is perfect.
SSE Sum of Squares Error. The sum of (Yi-Yfunc)2.

### Function Plot f(x)

The CHEMIX function plotter allows you to insert and plot math functions. Available functions are described in Calculator. Enter a function e.g. sin(x) in the Plot function f(x) text field and Calculate. A plot can now be seen in the plot area.

### Derivatives

You may plot derivatives of both the inserted function and XY-data simply by selecting one of the radio buttons (Y' or Y'') in the Derivatives area.
NOTE: Taking derivatives of XY-data will not alter any of the data presented in the XY Data field.

### Zoom

Zoom by moving the mouse cursor in plot area while left mouse button is pressed. The zoom actually occurs when releasing the mouse button. If you want to go back to initial XY-max/min values (un-zoom), simply press left mouse button in the plot area and release without moving the mouse cursor.
Note: If any zoom exceeds factor 1/2000, initial xy-max/min values (before zoom) will automatically be selected.

### Max/Min Limits in a Plot

A built-in feature in CHEMIX uses a set of rules finding the y-limits in a function plot.
If both XY-data and a function are present,- it will be the extreme max/min limits of the xy-data in which will decide these limits. In the case of the presence of function plot only, y-limits will be calculated automatically and x-limits manually.

A function plot may involve trig.func. as sin(x),cos... You may select Radians or Degrees (Degrees unselected).

### Data Manipulation g(x,y)

It is possible to manipulate inserted or generated XY-data . This can be done by inserting a function in the Data Manipulation f(x,y) field an Calculate. None of the raw data seen in the Data XY-field will be altered during this operation,.. the result can only be seen graphically as a plot. It is possible to insert both X and Y.
E.g. Y=Y meaning Yi (new)=Yi (old) does not change anything while Y=Y/X meaning Yi (new)=Yi (old)/Xi does change all the Y-values in the plot. All available functions are described in Calculator.

### Interpolate (Data X Y)

By selecting Interpolate, lines may be drawn between points. Polyline draw straight lines between the points. Natural cubic spline assigns third order polynomials to the points.

### Printing

You may send the plotted curve to a printer by selecting the Print Button (printer graphic). The hard copy will have the same format as seen on the screen.

### Calculate

Plot the selected curve by the use of the Calculate push button. This button also automatically calculate max/min limits for the plot, unless the content in one of the X-min X-max Y-min... (manual limits) fields prior to the use of this button has been altered.
NOTE:In some cases when a data set contain "illegal values", as when the denominator in a hyperbolic function equals zero, no fit/plot will occur.

Curve fitting software
Graph plot software

Chemistry Software - Home