CMPS1371 Introduction to Computing for Engineers NUMERICAL METHODS.

Slides:



Advertisements
Similar presentations
AP Statistics Section 3.2 C Coefficient of Determination
Advertisements

11-1 Empirical Models Many problems in engineering and science involve exploring the relationships between two or more variables. Regression analysis.
Regression Analysis Using Excel. Econometrics Econometrics is simply the statistical analysis of economic phenomena Here, we just summarize some of the.
Chapter 18 Interpolation The Islamic University of Gaza
CITS2401 Computer Analysis & Visualisation
ES 240: Scientific and Engineering Computation. InterpolationPolynomial  Definition –a function f(x) that can be written as a finite series of power functions.
Lecture 11 Chap. 15. Outline Interpolation – Linear Interpolation – Cubic Spline Interpolation – Extrapolation 15.2 Curve.
MATLAB EXAMPLES Interpolation and Integration 58:111 Numerical Calculations Department of Mechanical and Industrial Engineering.
Newton-Cotes Integration Formula
Curve Fitting and Interpolation: Lecture (IV)
Curve-Fitting Regression
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW III.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 24 Regression Analysis-Chapter 17.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 CURVE.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 Least.
Least Squares Regression Line (LSRL)
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Numerical Differentiation and Integration Part 6 Calculus.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 21 Newton-Cotes Integration Formula.
Engineering Analysis ENG 3420 Fall 2009
MECN 3500 Inter - Bayamon Lecture Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Integration Integration: is the total value, or summation, of f(x) dx over the range from a to b:
Introduction to MATLAB for Engineers, Third Edition Chapter 6 Model Building and Regression PowerPoint to accompany Copyright © The McGraw-Hill Companies,
1 4. Curve fitting On many occasions one has sets of ordered pairs of data (x 1,...,x n, y 1,...,y n ) which are related by a concrete function Y(X) e.g.
Analytical vs. Numerical Minimization Each experimental data point, l, has an error, ε l, associated with it ‣ Difference between the experimentally measured.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Curve Fitting.
© 2008 Pearson Addison-Wesley. All rights reserved Chapter 1 Section 13-6 Regression and Correlation.
Recap Summary of Chapter 6 Interpolation Linear Interpolation.
MECN 3500 Inter - Bayamon Lecture 9 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Curve Fitting and Regression EEE 244. Descriptive Statistics in MATLAB MATLAB has several built-in commands to compute and display descriptive statistics.
Chapter 8 Curve Fitting.
Department of Mechanical Engineering, LSU Session IV MATLAB Tutorials Session IV Mathematical Applications using MATLAB Rajeev Madazhy
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Curve-Fitting Regression
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. 1 Part 6 - Chapter 21.
Numerical Integration
Recap Cubic Spline Interpolation Multidimensional Interpolation Curve Fitting Linear Regression Polynomial Regression The Polyval Function The Interactive.
Polynomials, Curve Fitting and Interpolation. In this chapter will study Polynomials – functions of a special form that arise often in science and engineering.
MODEL FITTING jiangyushan. Introduction The goal of model fitting is to choose values for the parameters in a function to best describe a set of data.
Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 15 General Least Squares and Non- Linear.
Recap Functions with No input OR No output Determining The Number of Input and Output Arguments Local Variables Global Variables Creating ToolBox of Functions.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 5 Integration and Differentiation.
1 Lecture 8 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 17 and 18 Interpolation.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 13.1 Interpolation between.
Copyright © Cengage Learning. All rights reserved. 8 9 Correlation and Regression.
Interpolation - Introduction
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 20 Numerical Integration of Functions.
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.
CMPSC 200 Fall 2013 Lecture 37 November 18, 2013.
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Introduction to Programming for Mechanical Engineers
Part 6 - Chapter 21.
Part 5 - Chapter
Part 5 - Chapter 17.
EEE 244-7: Curve Fitting.
Numerical Integration Formulas
Chapter 22.
1) A residual: a) is the amount of variation explained by the LSRL of y on x b) is how much an observed y-value differs from a predicted y-value c) predicts.
Statistical Methods For Engineers
Lecture 10 2D plotting & curve fitting
Chapter 12 Curve Fitting : Fitting a Straight Line Gab-Byung Chae
Part 5 - Chapter 17.
MATH 2140 Numerical Methods
Linear regression Fitting a straight line to observations.
SKTN 2393 Numerical Methods for Nuclear Engineers
Assignment 1: due 1/16/19 Estimate all of the zero of x3-x2-2x+1 graphically. Write a MatLab code for Newton’s method. Use your code to refine the graphical.
SKTN 2393 Numerical Methods for Nuclear Engineers
Assignment 1: due 1/17/19 Estimate all of the zero of x3-x2-2x+1 graphically. Write a MatLab code for Newton’s method. Use your code to refine the graphical.
Presentation transcript:

CMPS1371 Introduction to Computing for Engineers NUMERICAL METHODS

Interpolation When you take data, how do you predict what other data points might be? Two techniques are : Linear Interpolation Cubic Spline Interpolation

Linear Interpolation Assume the function between two points is a straight line What is the corresponding value of y for this x?

How do you find a point in between? X=2, Y=? Linear Interpolation – Connect the points with a straight line to find y

MATLAB Code interp1 is the MATLAB function for linear interpolation First define an array of x and y Now define a new x array, that includes the x values for which you want to find y values new_y = interp1(x,y,x_new)

Both measured data points and interpolated data were plotted on the same graph. The original points were modified in the interactive plotting function to make them solid circles.

Cubic Spline A cubic spline creates a smooth curve, using a third degree polynomial We can get an improved estimate by using the spline interpolation technique

Cubic Spline Interpolation. The data points on the smooth curve were calculated. The data points on the straight line segments were measured. Note that every measured point also falls on the curved line.

Curve Fitting There is scatter in all collected data We can estimate the equation that represents the data by “eyeballing” a graph There will be points that do not fall on the line we estimate

This line is just a “best guess”

Least Squares Finds the “best fit” straight line Minimizes the amount each point is away from the line It’s possible none of the points will fall on the line Linear Regression

Polynomial Regression Linear Regression finds a straight line, which is a first order polynomial If the data doesn’t represent a straight line, a polynomial of higher order may be a better fit

polyfit and polyval polyfit finds the coefficients of a polynomial representing the data polyval uses those coefficients to find new values of y, that correspond to the known values of x

Coefficients of the first order polynomial describing the best fit line

Linear Regression (First Order) Evaluate how close a fit you’ve achieved by taking the difference between the measured and calculated points, and adding them up

Second Order Fit

A fifth order polynomial gives a perfect fit to 6 points

Using the Interactive Curve Fitting Tools MATLAB 7 includes new interactive plotting tools. They allow you to annotate your plots, without using the command window. They include basic curve fitting, more complicated curve fitting statistical tools

Use the curve fitting tools… Create a graph Making sure that the figure window is the active window select Tools-> Basic Fitting The basic fitting window will open on top of the plot

Plot generated using the Basic Fitting Window

Residuals are the difference between the actual and calculated data points

Basic Fitting Window

Data Statistics Window You can also access the data statistics window from the figure menu bar. Select Tools->Data Statistics from the figure window. This window allows you to calculate statistical functions interactively, such as mean and standard deviation, based on the data in the figure, and allows you to save the results to the workspace.

Differences and Numerical Differentiation We can use symbolic differentiation to find the equation of the slope of a line The diff function is easy to understand, even if you haven’t taken Calculus It just calculates the difference between the points in an array

The derivative of a data set can be approximated by finding the slope of a straight line connecting each data point

The slope is an approximation of the derivative – in this case based on data measurements

Approximating Derivatives when you know the function If we know how y changes with x, we could create a set of ordered pairs for any number of x values. The more values of x and y, the better the approximation of the slope

The slope of a function is approximated more accurately, when more points are used to model the function

Numerical Differentiation The derivative of a function is equal to the rate of change of f(x) with respect to x Differentiating f(x)

Graph the derivative Consider the function f(x) = x 6 – 0.3x 5 – x x 3 – 187.2x

Slope of f(x) and f’(x)

Critical Points We can compute the compute the location of the functions critical points (points of zero slope) >> product = df(1:end-1).* df)2:end); >> critical = xd(find(product < 0)); critical =

Numerical Integration MATLAB handles numerical integration with two different quadrature functions quad quadl

The area under a curve can be approximated using the trapezoid rule. An integral is often thought of as the area under a curve

Quadrature functions quad uses adaptive Simpson quadrature quadl uses adaptive Lobatto quadrature Both functions require the user to enter a function in the first field. called out explicitly as a character string defined in an M-file anonymous function. The last two fields in the function define the limits of integration