Curve FittingCurve fitting is finding a line or curve that passes most closely through a given set of points, minimizing the distances between the line and the actual points and providing the function whose curve is the line.
Entering the points
Suppose you have some data involving two variables, in the
form of several pairs of values for them. To find about the relationship
between the variables, the first step is to plot the pairs of values as
points on a graph, using the
tool. In case you have only two points you can use the
tool to mark them.
I n case you have several different sets of
points marked on the image with the
tool, open the Measurement window, select the desired
set of points in the measurement grid and then click the
button on the Measurement window toolbar. Alternatively you
can click the same
button on the Main toolbar. If you do
not select any point, the program will offer you two choices: cancelling
or using all points on the image.
If either line or only two points are selected, the program will calculate a lineal function for that line, but if more than two points are used the program will open a the following window to select which best-fit line method you want to use:
In all cases you can set the color used to plot the line. Each time you click Apply, a new function will be calculated and another line will be drawn. Click close when you are done.
Notice that the best-fit line does not necessarily pass through any of the points plotted.
If a segment was used, then the calculation results will be appended a comment to the segment drawn to show the best-fit line.
Options tab
When a set of points is used, a new measurement showing the curve will be added and the function and settings will be appended as a comment.
The image to the left shows the Curve fitting window,
it has Apply and Close buttons. Click Apply to
draw the curve, if you are satisfied with the curve, then click
Close to terminate the measurement.
In case you want to play with different functions and settings, you can
modify the settings and the curve color and click Apply again,
each time you click Apply a new curve will be drawn. or the previous
curve will be replaced if Replace select curve is selected. If
a new curve is added, consequently a new measurement will be created.
Curves always will be calculated using Cartesian coordinates, no matter if another origin of coordinate system is set in the Preferences window,
Note:
Origin of coordinates system: Different from usual standard graphing, computer graphic coordinates start at the top left corner of the image, so the Y axis goes from top to bottom, not otherwise.
Nevertheless, when calculating a Curve fitting measurement, normal Cartesian coordinates are used in all cases, so graphics coordinates are counted from the bottom left corner of the image.
From all other measurements, you can use upper or lower left coordinates, setting them in the Preferences window.
Notice that the set of points used to calculate may or not show its coordinates as Cartesian in the Measurement windows, it depends on Preferences settings, but the coordinates always will be converted to Cartesian before calculating a Curve Fitting measurement.
Example
| Two Polynomial Approximation curves and plotted points. | Equation and settings as shown in the measurement comments pane, for the magenta curve |
|
Polynomial Approximation |
|
Note: depending on the chosen Precision setting, the resulting numbers will be longer or shorter. |
|
Two-variable Statistics and Linear Regression
Two variable statistics make possible the development of a relationship (correlation) between two sets of data. Each pair of data has x and y values. From these sets of data a line of regression can be established. The relationship of the two sets of data by use of the straight line method is called Linear Regression. In Linear Regression there are three important values, r, a, and b.
The equation of the straight line is y = a + bx, where a is the point at which the line crosses the Y-axis and b is the slope of the line.
The correlation coefficient r shows the relationship between two sets of data. A perfect correlation between two values is an r equal to 1 (-1 is a perfect negative correlation); in other words, by knowing the value of one variable you can predict with 100% accuracy the value of the other variable. The further the value of r is from 1, the less reliable will your predictions be. The following table can be used as a set of definitions of the values of the correlation coefficient:
|
|
Value of r | Call it |
|
Positive |
+0.80 to +1.00 |
Extra High |
|
|
-0.20 to +0.20 |
Nil |
|
Negative |
-0.20 to -0.40 |
Low |