Sunteți pe pagina 1din 7

C&PE 121

Prelab 4

Goals
This lab demonstrates:

Excel Regression tools

Excel Goal Seek for solving non linear equation

Prelab
Complete the problems given in this document in separate worksheets. Name the worksheets with the problem
number. Submit the excel spreadsheet file via the Blackboard prelab assignment link by the start of your lab
class. Name the file CPE121_PRELAB4_first initial followed by last name (for instance
CPE121_PRELAB4_bsmith). Save the file as an Excel workbook. Before you work on this Prelab it is
recommended you read your textbook pages 256-277.

Problem 1 ( 1.5 pts.)


You will use Excel tools to fit the water density data in Table 1 to a line and a quadratic equations. Make sure
you use marker for plotting the data, and lines for the fitted equations.
Enter your name in cell A1 in the Problem1 sheet. Enter the data from Table 1 into the spreadsheet as shown
in the sreenshot shown below. Add the two extra columns containing T and T2 as shown in screenshot. These
columns will be needed for the polynomial regression.
Table 1: Water Density
Temperature
Density
(kg/m3)
(C)
0
2
4
6
10
15
20
25
30

999.87
999.97
1000.00
999.97
999.73
999.13
998.23
997.08
995.68

Using Excel Trendline Chart Tool


Plot the density as a function of the temperature by inserting a Scatter
with markers chart. Add to the data the legend label Experimental. Add
title and axes labels to the plot as shown in the screenshot below. Click
with the mouse nearby so the data points are selected. When they are
selected, press the right botton
of the mouse. In the option list
that opens select (left-click
with the mouse) Add
Trendline. Make sure the
optionLinear is selected in
the Format Trendline box
that appears to the right. Select
the option Custom for the
Trendline Name and type
Best-Fit Line in the textbox
that is at the right. Then select
the option Display Equation
on chart and Display R-squared values on chart.

C&PE 121
Prelab 4
2
Select with the mouse the Experimental data in the chart (one more time). Again, click the right mouse button
and left-click in the Add Treadline option. Now select the option Polynomial and make sure the Order is
2. Select the Custom option for the Trandline Name and type Quadratic in the textbox. Again select the
options: Display Equation on chsrt and Display R-squared values on chart. Just as shown below. Then leftclick with the mouse the paint bucket icon under the label TRENDLINE OPTIONS. Left-click with the
mouse in the options for the Dash type. There left-click the option Long Dash.

Your plot should look simitar to the plot shown


at the rigth. You have fitted (regressed) a line
and a quadratic equation to the experimental
data. As you see in the picture, the quadratic
equation better fits the experimental data.

C&PE 121

Prelab 4

Using Excel SLOPE, INTERCEPT and RSQ Functions


Name the cell range (B4:B12) containing the temperature data to T and the cell range (C4:C12) containing the
density data to D.
In cells C14, C15 and C16 the labels shown in the screenshot below and calculate the slope, intercept and
coefficient of determination using the Excel functions SLOPE, INTERCEPT and RSQ and the cell ranges T and
D. The sreenshots below shows the formulas you must type in cells D14, D15 and D16 and the results.

Note that the results that you get with this functions are the same as the resutls displayed with the Trendline
tool for the best-fit line.
Using Excel LINEST Function
In cell B18 type the label: Quadratic Fit Equation. Then select with the maouse the cell range E4:F12 that
contains temperature andsquared temperature values. Once you have selected the cell range, left click with the
mouse the Name Box and type TPoly2. Now, select with the mouse the cell range B20:D24 and type the
formula =LINEST(D,TPoly2,TRUE,TRUE). After typing the formula press together the keys
<Shift><Ctrl><Enter> to display the quadratic fit equations and statistics.. Add labels as shown below.

Now practice using the LINEST function in a different


form. You will enter the data for the fit equation using
only the cell ranges D and T and you will display only the
quadratic equation coefficients m2, m1 and b:
First select with the mouse the cell range F20:H20. Then
type =LINEST(D,T^{1,2},TRUE,FALSE) and finish by pressing together the keys <Shift><Ctrl><Enter>.
Add labels as shown in the next screenshot.

C&PE 121

Prelab 4

Use Excel TREND Function to Interpolate Data Using Quadratic Model


In cell B4 type the formula:
=TREND(D,TPoly2,B4^{1,2},TRUE).
Copy the formula to the rows below for all the
temperature data. Format the results to have
three decimal digits. Note that the density
results that you get with the TREND function
are very close to the experimental density
results.
Using Excel Data Analysis Tool Pack
First check that the Data Analysis tool pack
is included in the tools of the Ribbon tab
Data (click in the tab Data and look for the
icon close to the top right corner).

If the Data Analysis icon is not there, then


click in the tab File. Next from the right list
left click in Options, then in Add-Ins. Near
the bottom of the dialog window and in front of
the label Manage the option Excel Add-ins
should be displayed. If not select it using the
arrow at the right and of the box. Then leftclick with the mouse the button Go. In the
dialog that opens select: Analysis ToolPack,
Analysis Toolpack-VBA and Solver Add-In.
The last two add-ins wont be used in the lab,
but well use them later in the semester.

Now you are ready to use the Data


Analysis tool. Left-click in the Ribbon
tab Data and next left-click in the
Data Analysis icon. Look in the list of
Analysis Tools for the option Regression and select it (leftclick with the mouse) and click OK.

C&PE 121
Prelab 4
5
In the dialog window that opens fill the textboxes and check options as shown in the following screenshot.
Specially make sure the Labels option has been checked. Once youve filled and selected options left-click the
OK button. A new worksheet (P1DataAnalysis) with the output from the Data Analysis tool is inserted in
your workbook.

Note in the worksheed P1DataAnalysis that theR square value (cell B5) and
quadratic fit coefficients (cells B17:B19) are the same as those that you got with the
trendline tool and the LINEST function. Also note that the Density calculated and
displayed in cells B26:B34 are the same values as those calculated with the TREND
function.

Grade Checklist
(0.05 pt) Student name in cell A1.
(0.10 pt) Entered data from Table 1 and added columns for T and T2.
(0.20 pt) Plotted data as points (no lines) and added title and axes labels.
(0.10 pt) Added Best-Fit Line trendline displaying equation and R2.
(0.10 pt) Added Quadratic trendline displaying equation and R2.
(0.05 pt) Quadratic trendline was formatted to be Long Dash
(0.10 pt) Named cell ranges T, D and TPoly2.
(0.25 pt) Used Excel LINEST function to calculate quadratic fit using D and TPoly2, displayed statisctics and
added labels to identify results.
(0.15 pt) Used Excel LINEST function to calculate quadratic fit using D and T (with special notation to use
quadratic equation), did not display statisctics and added labels to identify results.
(0.15 pt) Used Excel TREND function tool to calculate density using a quadratic fit equation.
(0.25 pt) Used Data Analysis tool to calculate quadratic fit, selected options as indicated in instructions.

C&PE 121

Prelab 4

Problem 2 ( 0.5 pts.)


You will use the Excel tool Goal Seek to find the roots of a nonlinear equation. Section 9.6 (pages 368 to 370)
explains the use of the Excel Goal Seek tool to find the three roots to the equation f(x) = x3 - 17 x + 12 = 0.
Enter your name in cell A1 in the Problem2 sheet. Setup data and formulas in worksheet Problem2 to find
the three roots as shown in the next screen shot. In cells B2, E2 and H2 type the values 0.8, 3.6 and -4,
respectively. In cells B3, E3 and H3 type the values 0.8, 3.6 and -4, respectively. The values typed in row two
will be used to remember which were the initial values used. When you use Goal Seek the values in B3, E3
and H3 will be modified and will contain the solution (roots). Format cells B2, B3, E2, E3, H2 and H3 to be
Number with four decimal digits.

Type in cells B4, E4 and H4 the formulas shown in the following screenshot. Leave the format of cells B4, E4
and H4 to be General.

Left-click in the tab Data, then left-click in the icon What-If-Analysis and left-click in the option Goal
Seek.

In the dialog window that opens follow the textboxes as shown in the screenshot shown below.
Goal Seek should converge as shown below.

C&PE 121

Prelab 4

Repite the procedure using cells E3 and E4 to find the second root, x = 3.7102, in cell E3.
Repite the procedure using cells H3 and H4 to find the third root, x = -4.4389, in cell H3.
Your final worksheet Problem2 should look similar to the worksheet in the following screenshot.

Grade Checklist
(0.10 pt) Typed labels, initial values in cells B2, E2 and H2, and guess values in cells B3, E3 and H3
(0.30 pt) Typed formula in: cell B4 using value in cell B3, cell E4 using value in cell E3, and cell H4 using
value in cell H3
(0.10 pt) Calculated the three roots.

S-ar putea să vă placă și