11/20/2015ENGR 111A - Fall 20041 MatLab – Palm Chapter 5 Curve Fitting Class 14.1 Palm Chapter: 5.5-5.7.

Slides:



Advertisements
Similar presentations
Empirical Model Building I: Objectives: By the end of this class you should be able to: find the equation of the “best fit” line for a linear model explain.
Advertisements

Class 7.2: Graphical Analysis and Excel Solving Problems Using Graphical Analysis.
Correlation and regression
Chapter 10 Regression. Defining Regression Simple linear regression features one independent variable and one dependent variable, as in correlation the.
EGR 105 Foundations of Engineering I
ENGR-25_Plot_Model-4.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Registered Electrical.
Excel Part III Curve-Fitting, Regression Section 8 Fall 2013 EGR 105 Foundations of Engineering I.
CITS2401 Computer Analysis & Visualisation
Today we will graph linear equations in slope intercept form.
+ Slope-Intercept Form of a Linear Equation Algebra y = mx + b.
Linear Equations in Two Variables
11.6 The Slope Intercept Form
Engineering experiments involve the measuring of the dependent variable as the independent one has been altered, so as to determine the relationship between.
Engineering Fundamentals and Problem Solving, 6e Chapter 5 Representation of Technical Information.
EGR 105 Foundations of Engineering I Fall 2007 – week 7 Excel part 3 - regression.
EGR 105 Foundations of Engineering I Fall 2007 – week 7 Excel part 3 - regression.
~adapted from Walch Education CONSTRUCTING FUNCTIONS FROM GRAPHS AND TABLES.
Chapter 5 Plotting Data Curve Fitting, Good Graphing Practices Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Directions: Solve the linear systems of equations by graphing. Use the graph paper from the table. Tell whether you think the problems have one solution,
Math I, Sections 2.5 – 2.9 Factoring Polynomials
Systems of Linear Equations Recalling Prior Knowledge.
Lesson Nonlinear Regression: Transformations.
GRAPHS AND LINEAR EQUATIONS. LINEAR EQUATION A linear equation is an algebraic equation in which each term is either a constant or the product of a constant.
Physics 114: Lecture 17 Least Squares Fit to Polynomial
Exponentials, logarithms and rescaling of data Math 151 Based upon previous notes by Scott Duke- Sylvester as an adjunct to the Lecture notes posted on.
9 - 1 Intrinsically Linear Regression Chapter Introduction In Chapter 7 we discussed some deviations from the assumptions of the regression model.
Least-Squares Regression
CMPS1371 Introduction to Computing for Engineers NUMERICAL METHODS.
Graphing Linear Equations
Empirical Model Building Ib: Objectives: By the end of this class you should be able to: Determine the coefficients for any of the basic two parameter.
Introduction to MATLAB for Engineers, Third Edition Chapter 6 Model Building and Regression PowerPoint to accompany Copyright © The McGraw-Hill Companies,
Bivariate Data When two variables are measured on a single experimental unit, the resulting data are called bivariate data. You can describe each variable.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Curve Fitting.
Fitting Curves to Data Lesson 4.4B. Using the Data Matrix Consider the table of data below. It is the number of Widgets sold per year by Snidly Fizbane's.
Correlation, linear regression 1. Scatterplot Relationship between two continouous variables 2.
Transformations Translation “Slide” Left: subtract from x-coordinate Right: add to x-coordinate Down: subtract from y-coordinate Up: add to y-coordinate.
Warm Up Solve for y when x = 0. 1.y = 8x – 2 2.6x + y = 2 3.2x – 3y + 6 = 0 4.4x – 2y = x – 14y -5 = 0.
1 What you will learn today 1. New vocabulary 2. How to determine if data points are related 3. How to develop a linear regression equation 4. How to graph.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers Chapter 5B Model.
Chapter 13 The Math for Graphing in DC Circuits. Graphing Overview  Critical for practical analysis many different natural systems. Note: Theoretical.
May 2004 Prof. Himayatullah 1 Basic Econometrics Chapter 6 EXTENSIONS OF THE TWO-VARIABLE LINEAR REGRESSION MODEL.
Ch 7 Graphs and Linear Equations Review on Graphing.
Lecture 10 2D plotting & curve fitting Subplots Other 2-D Plots Other 2-D Plots Curve fitting © 2007 Daniel Valentine. All rights reserved. Published by.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers Chapter 5B Model.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 7 Algebra: Graphs, Functions, and Linear Systems.
Scatter Diagrams Objective: Draw and interpret scatter diagrams. Distinguish between linear and nonlinear relations. Use a graphing utility to find the.
Requirements of a good GRAPH. GRAPH  Title (usually “dependent” vs. “independent”)  Go Big (cover at least ½ the page in both directions) This increases.
Solving Exponential Equations. We can solve exponential equations using logarithms. By converting to a logarithm, we can move the variable from the exponent.
Polynomials, Curve Fitting and Interpolation. In this chapter will study Polynomials – functions of a special form that arise often in science and engineering.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 15 General Least Squares and Non- Linear.
Understand the system of simultaneous linear equations. Solve the system of simultaneous linear equations involving two variables. Students and Teachers.
The General Linear Model. Estimation -- The General Linear Model Formula for a straight line y = b 0 + b 1 x x y.
7.3 Linear Equations and Their Graphs Objective: To graph linear equations using the x and y intercepts To graph horizontal and vertical lines.
Ch 7 Graphs and Linear Equations Review on Graphing.
Graphing Linear Equations Chapter 7.2. Graphing an equation using 3 points 1. Make a table for x and y to find 3 ordered pairs. 2. I choose 3 integers.
Chapter 14 Introduction to Regression Analysis. Objectives Regression Analysis Uses of Regression Analysis Method of Least Squares Difference between.
Chapter 10 Notes AP Statistics. Re-expressing Data We cannot use a linear model unless the relationship between the two variables is linear. If the relationship.
Tables & Graphing Laboratory Skills. Basic Tables Tables, or charts, are used to organize information Tables, or charts, are used to organize information.
Lecture 29: Modeling Data. Data Modeling Interpolate between data points, using either linear or cubic spline models Model a set of data points as a polynomial.
Chapter 2 Functions and Graphs
Aim: What is the logarithms?
Fitting Equations to Data
Graphing Linear Equations
Lecture 10 2D plotting & curve fitting
MatLab – Palm Chapter 5 Curve Fitting
Aim: What is the logarithms?
Graphing Linear Equations
Algebra 1 Section 6.3.
7.2 Graphing Equations Objectives:
7.2 Graphing Equations.
Presentation transcript:

11/20/2015ENGR 111A - Fall MatLab – Palm Chapter 5 Curve Fitting Class 14.1 Palm Chapter:

11/20/2015ENGR 111A - Fall Learning Objectives Students should be able to: Use the Function Discovery (i.e., curve fitting) Techniques Use Regression Analysis

11/20/2015ENGR 111A - Fall Function Discovery Engineers use a few standard functions to represent physical conditions for design purposes. They are: Linear: y(x) = mx + b Power:y(x) = bx m Exponential:y(x) = be mx (Naperian) y(x) = b(10) mx (Briggsian) The corresponding plot types are explained at the top of p. 299.

11/20/2015ENGR 111A - Fall Steps for Function Discovery 1. Examine data and theory near the origin; look for zeros and ones for a hint as to type. 2. Plot using rectilinear scales; if it is a straight line, it’s linear. Otherwise: a) y(0) = 0 try power function b) Otherwise, try exponential function 3. If power function, log-log is a straight line. 4. If exponential, semi-log is a straight line.

11/20/2015ENGR 111A - Fall Example Function Calls polyfit( ) will provide the slope and y-intercept of the BEST fit line if a line function is specified. Linear: polyfit(x, y, 1) Power: polyfit(log10(x),log10(y),1) Exponential:polyfit(x,log10(y),1); Briggsian polyfit(x,log(y),1); Naperian Note: the use of log10( ) or log( ) to transform the data to a linear dataset.

11/20/2015ENGR 111A - Fall Example 5.5-1: Cantilever Beam Deflection First, input the data table on page 304. Next, plot deflection versus force (use data symbols or a line?) Then, add axes and labels. Use polyfit() to fit a line. Hold the plot and add the fitted line to your graph.

11/20/2015ENGR 111A - Fall Solution

11/20/2015ENGR 111A - Fall Straight Line Plots Forms of EquationStraight Line Systems MatLab Syntax Linear Equation y = mx + b Rectilinear System plot(x,y) Power Equation y=bx m Loglog System loglog(x,y) Exponential Equation y = be mx or y=b10 mx Semilog System semilogy(x,y)

11/20/2015ENGR 111A - Fall Why do these plot as lines? Exponential function: y = be mx Take the Naperian logarithm of both sides: ln(y) = ln(be mx ) ln(y) = ln(b) + mx(ln(e)) ln(y) = ln(b) + mx Thus, if the x value is plotted on a linear scale and the y value on a log scale, it is a straight line with a slope of m and y- intercept of ln(b).

11/20/2015ENGR 111A - Fall Why do these plot as lines? Exponential function: y = b10 mx Take the Briggsian logarithm of both sides: log(y) = log(b10 mx ) log(y) = log(b) + mx(log(10)) log(y) = log(b) + mx Thus, if the x value is plotted on a linear scale and the y value on a log scale, it is a straight line. (Same as Naperian.)

11/20/2015ENGR 111A - Fall Why do these plot as lines? Power function: y = bx m Take the Briggsian logarithm of both sides: log(y) = log(bx m ) log(y) = log(b) + log(x m ) log(y) = log(b) + mlog(x) Thus, if the x and y values are plotted on a on a log scale, it is a straight line. (Same can be done with Naperian log.)

11/20/2015ENGR 111A - Fall In-class Assignment Given: x=[ ]; y 1 =[ ]; y 2 =[ ]; y 3 =[ ]; 1. Use MATLAB to plot x vs each of the y data sets. 2. Chose the best coordinate system for the data. 3. Be ready to explain why the system you chose is the best one.

11/20/2015ENGR 111A - Fall Solution

11/20/2015ENGR 111A - Fall Be Careful 1. What value does the first tick mark after 10 0 represent? What about the tick mark after 10 1 or 10 2 ? 2. Where is zero on a log scale? Or -25? 3. See pages 282 and 284 of Palm for more special characteristics of logarithmic plots.

11/20/2015ENGR 111A - Fall How to use polyfit command. Linear: pl = polyfit(x, y, 1) m = pl(1); b = pl(2) of BEST FIT line. Power: pp = polyfit(log10(x),log10(y),1) m = pp(1); b = 10^pp(2) of BEST FIT line. Exponential: pe = polyfit(x,log10(y),1) m = pe(1); b = 10^pe(2), best fit line using Briggsian base. ORpe = polyfit(x,log(y),1) m = pe(1); b = exp(pe(2)), best fit line using Naperian base.

11/20/2015ENGR 111A - Fall In-class Assignment Determine the equation of the best-fit line for each of the data sets in In-class Assignment Hint: use the result from ICA and the polyfit( ) function in MatLab. Plot the fitted lines in the figure.

11/20/2015ENGR 111A - Fall Solution

11/20/2015ENGR 111A - Fall Regression Analysis Involves a dependent variable (y) as a function of an independent variable (x), generally: y = mx + b We use a “best fit” line through the data as an approximation to establish the values of: m = slope and b = y-axis intercept. We either “eye ball” a line with a straight-edge or use the method of least squares to find these values.

11/20/2015ENGR 111A - Fall Curve Fits by Least Squares Use Linear Regression unless you know that the data follows a different pattern: like n-degree polynomials, multiple linear, log-log, etc. We will explore 1st (linear), … 4th order fits. Cubic splines (piecewise, cubic) are a recently developed mathematical technique that closely follows the “ship’s” curves and analogue spline curves used in design offices for centuries for airplane and ship building. Curve fitting is a common practice used my engineers.

11/20/2015ENGR 111A - Fall T5.6-1 Solve problem T5.6-1 on page 318. Notice that the fit looks better the higher the order – you can make it go through the points. Use your fitted curves to estimate y at x = 10. Which order polynomial do you trust more out at x = 10? Why?

11/20/2015ENGR 111A - Fall Solution

11/20/2015ENGR 111A - Fall Solution