"Laboratory Manual for General Physics", Bernard D.Kern. Part One: Mechanics, Heat and Sound, Revised Printing, 1996 Copyright C 1968, 1971, 1996 by Bernard Donald Kern
Scientists often display results in the form of graphs for clarity. A graph can display information that cannot easily be described by words or equations. In making a two-dimensional graph, you are plotting data pairs of two physical quantities in a coordinate system with horizontal and vertical axes. It is important to make the graph as clear as possible. Each graph should be a "stand alone" document. The graphs which you prepare in the laboratory reports will be judged on this criterion.
The following guide lines are provided for you to follow in making graphs.
Sometimes, error bars are used in a graph to convey information about random errors. Suppose we are plotting a y-versus-x graph. As we have discussed in Unit 1, any measurement will have random error. The y data we use to make the plot is actually the average value of y. We often draw a vertical line about the average value to represent the uncertainty of value of y. These vertical lines are called error bars. If we measure x instead of y, at certain fixed values of y, then the error bars will become horizontal. In some experiments, we may not be able to fix either x or y and both of them will have error. There will be error bars for both x and y and they will look like crosses.
Imagine you are studying two physical quantities called x and t. For each measured value of t, you measure the corresponding value of x simultaneously. At the end of the experiment, you will have a collection of x-t data pairs. If you plot the data on a graph so that the value of x is on the vertical axis and the value of t is on the horizontal axis, you are plotting x versus t (x vs t). In reverse, you may plot t on the vertical scale and x on the horizontal scale, then you are plotting t versus x (t vs x). Which one to choose depends on the convenience and clarity of the presentation.
One common situation is that the data points in a graph fall nearly on a straight line. You can draw a straight line, with a ruler, joining the data points together. This immediately implies that the two physical quantities you are studying have a linear relationship. Suppose you are plotting x versus t, a linear relationship between x and t means Eqn.1:
where A and B are constants. The values of A and B are given respectively by the slope and intercept at the vertical axis of the straight line. To determine the slope, you pick up two arbitrary points, not too close together on the straight line, (t1,x1) and (t2,x2).
From these two points you can calculate
and
. The slope of the straight line is given by Eqn.2:
Now, suppose that another student doing the same experiment plots t versus x, instead of x versus t. The data will still appear to fall on a straight line. However, the values of A and B in Eqn. 1 above will be given by 1/(slope) and the intercept at the horizontal axis of the straight line. Can you tell the difference between x-vs-t and t-vs-x now?
The data points from an actual experiment do not necessarily fall exactly on a straight line, even though the physical quantities follow a linear relationship. This is because random errors in measurements usually deviate the data points from a straight line. Since there is no straight line that can go through all data points at the same time, different persons may use different straight lines to approximate the data points and obtain different values for A and B in Eqn. 1 above. In situation like this, you should not try to draw a straight line that can pass through as many data points as possible. Instead, you should find a straight line by carefully balancing the total distance between the straight line and the data points on either side. This straight line does not need to pass through any data point, but it will have the minimum deviation from the data it represents. This method of determining the straight line is called the method of least squares. Many pocket calculators, PC spread sheets, and specialized graphics software provide least squares, or linear regression programs, to calculate the best fitting of a straight line to data.
Very often, the physical quantities involved do not follow a linear relationship. For example, instead of Eqn. 1 above, let us imagine the following relationship between x and t, Eqn.3:
x = At2 + B
The graph will not be a straight line any more, because of the square term in the equation. It is in general more difficult to draw a curve than a straight line. Furthermore, x = At2 + B and x = Ct3 + D will look very similar for x>0 with different choices of A and C, and B and D. How are we going to convince people that x = At2 + B is the best choice of equation to fit the data?
One common practice we find in scientific literature is to redefine the variables and try to make the equation linear. In the present Eqn. 3, we can define a new variable y = t2. For every measured value of t, we can calculate y. x and y will then follow a linear relationship x = Ay + B. If we plot x-versus-y, instead of x-versus-t, we will have a straight line! This is a simple idea, which it will make your presentation more impressive and the final graph easier to analyze.
One simple equation that people often use to analyze data is the so called power law, x = AtB, where A and B are to be determined by the measurement. In an x-versus-t graph, the data points will not follow a straight line. If we take the logarithm of both sides of the equation, it will become log x = log A + B log t. The data will follow a straight line in a log x-versus-log t plot and log A and B are given by the intercept and slope of the straight line. Log-log graph paper has non-linear scales designed so that if you plot x and t directly on it, log x and log t will become linear on the scale. Another common equation is x = A log t + B; here, x-versus-log t should be plotted for data to appear on a straight line. Semi-log graph paper is available.
This applet allows to enter and plot functions of one variable.
Enter expression with a variable x to be plotted, number of points to calculate and range of your variable in the corresponding textfields below the plotting area. Press the button "Plot the Function!"
Please note that recognition of function expressions is not fool proof. If the plotted curve looks wrong, use parenthesis to force the order of evaluation, see example below. The most likely place this will be needed in the use of power command ^.
Example: (1+(x^2)+(x^3))
The applet uses Graph Class Library by Leigh Brookshaw. Below are excerpts from the Library Documentation :
Known Bugs: The recoginition of function expressions is not fool proof. If the answer is wrong then use the parenthesis to force the order of evaluation. The most likely place this will be needed is in the use of the power command. The exponent is not evaluated correctly if it begins with a unary operator.
Once the function is plotted, you can modify with a mouse the range of data being plotted:
The applet also recognizes the following keys being pressed:
