470 likes | 634 Views
ME 232. Week 6 Notes. ME 232 Week 6 Notes. Curve Fitting Finite Statistics Least Squares Linear Regression Polynomial Regression EXCEL’s TRENDLINE Command Linear Interpolation EXCEL Interpolation Functions HLOOKUP VLOOKUP. Finite Statistics. Finite Statistics. Finite Statistics.
E N D
ME 232 Week 6 Notes
ME 232 Week 6 Notes • Curve Fitting • Finite Statistics • Least Squares Linear Regression • Polynomial Regression • EXCEL’s TRENDLINE Command • Linear Interpolation • EXCEL Interpolation Functions • HLOOKUP • VLOOKUP
A 2-sided confidence interval. s = true standard deviation, m = true mean
Comparison of the Normal (Gaussian Bell Curve) distribution good for n = ∞ against the finite t distribution valid for n ≤ 30
Linear Regression • Curve fitting technique • Derives a curve that minimizes the discrepancy between the actual data points and the curve fit itself • Least-Squares Linear Regression seeks to minimize the residual, e
Linear Regression Regression data showing (a) the spread of the data about the mean, and (b) the spread of the data about the best-fit line. Note the reduction in spread in going from (a) to (b), as indicated by the bell-shaped curves, which represent the improvement due to Linear Regression
Linear Regression Examples of Linear Regression with (a) small and (b) large residual errors.
Polynomial Regression • As just seen, some engineering models are inherently non-linear • We just used 3 simple examples to show how transformations can be used to map non-linear models into linear ones • An alternative to using transformations as just outlined is to fit polynomial models to the data using polynomial regression • The Least-Squares procedure is readily extended to higher-order polynomials as follows
EXCEL’s Trendline Command EXCEL Insert Trendline
e.g. Fit the following data using EXCEL’s Trendline command: 1. Input the data into a sheet and plot it as follows:
2. Click on one of the data markers to highlight the data set as shown:
3. Right click on the highlighted data point to invoke the Trendline menu:
5. Hit OK and view the chart, now it has a Logarithmic fit overlaid onto the raw data points
6. Place your mouse on the Trendline fit and click the Right mouse button, select Format Trendline
7. Under the Options tab, click Display equation on chart and Display R-squared value on chart as shown below:
8. Hit OK, now right click on the data label and format it as shown below:
Linear Interpolation • Frequently we must estimate intermediate values between precise data points • The simplest form of interpolation is to connect two data points with a straight line • This technique is called Linear Interpolation
Graphical depiction of linear interpolation. The shaded areas indicate the similar triangles used in the derivation of the linear interpolation formula.
Linear Interpolation Linear-Interpolation Formula The smaller the interval between the data points, the better the approximation
EXCEL’S HLOOKUP / VLOOKUP FUNCTIONS HLOOKUP( lookup_value, table_array, column_index_num, range_lookup) VLOOKUP( lookup_value, table_array, row_index_num, range_lookup) lookup_value = value that is desired, to be determined table_array = range reference or name of table containing data col_index_num / row_index_num = col/row of the table from which the value is to be returned range_lookup = TRUE/FALSE, specifying whether or not there was a match or not
EXCEL’S MATCH / INDEX FUNCTIONS MATCH( lookup_value, lookup_array, match_type) Returns the relative position of a lookup value in an array. Use 1 for match_type when the table is sorted in ascending order and you wish to find the largest value that is less than or equal to lookup_value. Use 0 when your need an exact match; the table need not be sorted. Use -1 when the table is sorted in descending order and you want to find the smallest value that is greater than or equal to lookup_value INDEX( array, row_num, column_num) The INDEX function returns an element from an array thus INDEX(A1:C10,2,3) returns the value at the intersection of row 2 and column 3 of the table A1:C10.
Table Lookup and Interpolation e.g. Steam Tables • Tables of T,p, density, enthalpy, and entropy of saturated steam and water, superheated steam, and compressed liquid water • Saturated steam and water is a mixture of steam and water at a T and p where they both co-exist in equilibrium. The water is said to be “saturated with heat”, i.e. any addition of more heat will boil off the liquid into steam • The saturation line on a graph of p vs. T divides the graph into all water and all steam regions as shown on the next chart
Table Lookup and Interpolation e.g. Steam Tables (continued) • Superheated steam data points are those T,p points above the saturation line in the direction of increasing temperature • Compressed liquid data points are those T,p points above the saturation line in the direction of increasing pressure • Steam tables are used by engineers who design and operate energy transportation and conversion equipment which employs steam as the working fluid • Engineers use the steam tables to compute the properties of hot, pressurized water and steam
Table Lookup and Interpolation e.g. Steam Tables (continued) • For instance, in a pressurized water reactor, if the pressure drops to the saturation line, the water flashes into steam • The T and p in the reactor then move along the saturation line until either the pressure is increased to the point that the water stops boiling into steam, or all of the water is boiled away (a bad thing) • Luckily, this is a self-quenching process. As the pressure decreases, the enthalpy (the heat-carrying capacity), also decreases causing the water temperature in the boiler to increase, because the heat flow from the heat generation region has been decreased
Table Lookup and Interpolation e.g. Steam Tables (continued) • Increasing the temperature increases the pressure and quenches the process • Typically, it is not a good idea to let your cooling water boil away inside a pressurized reactor, so (T,p) of about (600 F, 2250 psi) is a good operating rule of thumb, as it is safely away from the saturation line In the next example, we build a worksheet that calculates the saturate pressure for a given temperature.