0% found this document useful (0 votes)
44 views

Expt. 2 Graphing and Curve-Fitting

This document describes an experiment on graphing and curve-fitting. Students will (1) plot data points from a program, (2) determine the equation of the best-fit line, (3) sketch the line, and (4) determine the relationship between variables. They will manually graph points, calculate averages and equations to find the best-fit line, and compare their results to the computer's. The goal is to visually determine the relationship between variables from the best-fit line.

Uploaded by

uri choi
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Expt. 2 Graphing and Curve-Fitting

This document describes an experiment on graphing and curve-fitting. Students will (1) plot data points from a program, (2) determine the equation of the best-fit line, (3) sketch the line, and (4) determine the relationship between variables. They will manually graph points, calculate averages and equations to find the best-fit line, and compare their results to the computer's. The goal is to visually determine the relationship between variables from the best-fit line.

Uploaded by

uri choi
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Physics for Engineers

Experiment #2: Graphing and curve-fitting


Objectives: Gain a facility in graphing and curve-fitting by:
(i) plotting pre-set data points;
(ii) determining the equation of the best-fit line;
(iii) sketching the best-fit line based on its equation; and
(iv) determining the relationship between the plotted variables (distance and
time) based on the best-fit line; and

Equipment: Programs CURV-FIT.EXE

Collections of data may be presented in various forms. The telephone directory


is a simple listing, joining a name/address with a phone number. The multiplication
table is a rectangular array associating a single value to a pair of other values displayed
across the top and left edge of the display. Other data is more conveniently displayed
as a graph, such as the price of rice or the Peso-Dollar exchange rate over a given
period of time. Data from many of the experiments in Physics are best displayed by a
graph.

Graphs in Analytic Geometry normally have four “quadrants”: above or below the
horizontal, left or right of the vertical axes. Most graphs in Physics use a single
“quadrant”; Above the horizontal and to the right of the vertical axes. Numerical scales
are placed along each axis. Numbers along the horizontal axis represent distances
measured to the right of the vertical axis. Likewise, numbers along the vertical axis
measure distances above the horizontal axis. A data item associates two quantities,
such as room temperature and time of day. On the graph, a single point represents this
data item; distance from the vertical axis proportional to time of day, distance above
the horizontal axis proportional to room temperature.

Each axis must always have three


elements. (1) Label : are horizontal
distances temperature or time? (2)
Numbers: the data to be displayed is
numerical (not just “cool” or “warm”, not just
“early” or “late”), so numerical values must
be indicated of both axes. (3) Units: do the
numbers on the time axis represent hours,
minutes or seconds.

Graph points represent data items.


But how big is a point? In Math points have

Revised Nov. 2022_Physics for Engineers_BLENDED 1


no dimensions, but you draw your points big enough to easily distinguishable from any
accidental spider droppings nearby, but not as big as an ink-blot.

What about the range of numbers along any axis? The numbers should be
equally spaced. They need not start from zero. Rather, examine first the range of
data values along each axis, and from this, select the appropriate range values, so that,
as far as possible, your points cover most of the graph area. Graphs are more easily
constructed and read if the numerals are multiples of 2, 5 or 10.

The sample (wrong) graph shows temperature and time. Notice that for each
time value, there is only one temperature, while the same temperature may occur at
two or more different times (perhaps both morning and late afternoon). Here time is
said to be the independent variable, temperature the dependent. Normally the
independent variable is placed along the horizontal axis. Actually the temperature had
a definite value at every moment during the day, even though we have no data pairs for
this. Often a smooth curved line (temperature does not change abruptly during the
day) is drawn on the graph representing our “best guess” for the actual values. Do NOT
connect the points with short straight lines!

Curve-fitting
If we expect a linear relationship between the x and y coordinates of N points,
but admit that our measurements may not be too accurate, we might try to sketch a
“best-fit” straight line passing as close as possible to each point . Let the equation of the
supposed line be y = Ax + B, where A and B are constants, the slope and y-intercept
respectively. For any given point, [xj,yj] , its displacement is the vertical distance
between the point and the “best fit” line: yj – (Axj + B). This may be positive or
negative, as the point is above or below the line. For “best fit”, the sum of the absolute
value or of the square of these displacements should be a minimum.

Sum of square of each displacement = [yj –(Axj + B)]2 (1)

The mean square displacement is the sum, given by (1), divided by N, the number of
points. The root-mean-square displacement, also called the standard deviation, is
just the square root of the mean square displacement and is a measure of the spread
of points about the “best fit” line. Of course the standard deviation depends on our
choice of A and B.

To find the magic A and B, the first step is the expand the mean square
displacement expression ( Eq. 1 divided by N):

M.S.D. = (yj2 - 2A(xj yj ) - 2Byj + A2xj2 + 2ABxj + B2) / N (2)

Revised Nov. 2022_Physics for Engineers_BLENDED 2


Notice that xj / N is the average of the x-coordinates, (xj yj ) / N is the average of the
products of each coordinate pair (Careful! it’s the average of the products, NOT the
product of the averages). In what follows, we express the average of a quantity by { }
rather than by a bar above. Thus {x} stands for xj / N . With this notation we rewrite
(2) as:
M.S.D. = {y2} – 2A{xy} – 2B{y} + A2{x2} + 2AB{x} + B2 (3)
The M.S.D. expression is a function of the two unknown quantities, A and B, for all the
averages are already determined by the given coordinate pairs. So, what values of A
and B will make M.S.D. a minimum? This is a Calculus problem for maxima and minima
of a function of two variables. Set to zero the partial derivative with respect to A and B .
(M.S.D.)/A = 2A{x2} + 2B{x} – 2{xy} = 0 (4a)
(M.S.D.)/B = 2B + 2A{x} – 2{y} = 0 (5a)
This is just a pair of linear simultaneous equations which may be easily solved for A
and B.
{x2} A + {x} B = {xy} (4b)
{x} A + B = {y} (5b)

A = ({xy} – {x}{y}) / ( {x2} – {x}2 ) (7)


B = ({x2}{y} – {x}{xy}) / ( {x2} – {x}2 ) (8)

Notice both expressions have the same denominator, the difference between the
square of the average and the average of the squares.

To find the standard deviation, substitute these A and B values into (3) and take the
square root.

Std. Dev. = [ {y2} – 2A{xy} – 2B{y} + A2{x2} + 2AB{x}+ B2 ]1/2

Procedure:
1: Use the computer program CURV-FIT.EXE to generate your personal set of 10
data points, based on your own birthday. Print these or copy them from the screen
display.

2: Make a graph of these points manually.

3: Enter into the table below your [x,y] data values. With a calculator, fill in values for all
the remaining table locations.

Revised Nov. 2022_Physics for Engineers_BLENDED 3


4: Manually calculate the A and B values. Use these values to express the equation of
the best-fit line which takes the form, y = Ax + B, and draw the “best-fit” straight line.
Also, find the Standard Deviation. When you are done, compare your results with those
of the computer, and submit both versions with your report.
If you have a calculator with statistical functions, use it to compute A, B and Std. Dev.
for the given data points. This is the easiest method to obtain these values.

5: Compute the %error of your A, B, and standard deviation values where your
manually-computed” values are the “experimental values”, and the “computer-
calculated” values are the standard values. Analyze if your experimental values are
accurate enough to be acceptable (i.e.  5% error).

6: Examine the best-fit line of your graph. What does it visually show or indicate about
the relationship between the plotted distance and time graph? What is the purpose,
therefore, of sketching the best-fit line of graphs? Include a brief discussion on this in
your data analysis.

*NOTE: In later experiments you will collect data and will need to display this in graphical form and find the
expression for the “best-fit” graph line. For this purpose, the computer program LEAST-2.EXE can be helpful. It
accepts up to 60 data pairs, and graphs the points and provides the best fit linear ( y = mx + b ) and quadratic ( y =
Ax2 + Bx + C ) equations. However, you need to master graphing the points manually before using the graphing
program later.

DAT SHEET for the Manual Computations


Item x(time) y(distance) x2 y2 xy
1
2
3
4
5
6
7
8
9
10
sum
average
{x} {y} {x2} {y2} {xy}

Revised Nov. 2022_Physics for Engineers_BLENDED 4


A = __________ B = ___________ Std.Dev. = _________

---Nothing follows.---

Revised Nov. 2022_Physics for Engineers_BLENDED 5

You might also like