Department of Mechanical Engineering, LSU Session IV MATLAB Tutorials Session IV Mathematical Applications using MATLAB Rajeev Madazhy

Slides:



Advertisements
Similar presentations
ES 240: Scientific and Engineering Computation. Chapter 17: Numerical IntegrationIntegration  Definition –Total area within a region –In mathematical.
Advertisements

P M V Subbarao Professor Mechanical Engineering Department
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.
MATLAB EXAMPLES Interpolation and Integration 58:111 Numerical Calculations Department of Mechanical and Industrial Engineering.
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 30 Numerical Integration & Differentiation.
Curve-Fitting Interpolation
Curve-Fitting Polynomial Interpolation
Part 4 Chapter 13 Linear Regression
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW III.
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM.
Calibration & Curve Fitting
CpE- 310B Engineering Computation and Simulation Dr. Manal Al-Bzoor
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 21 Newton-Cotes Integration Formula.
MECN 3500 Inter - Bayamon Lecture Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
CMPS1371 Introduction to Computing for Engineers NUMERICAL METHODS.
Chapters 5 and 6: Numerical Integration
Chapter 9 Function Approximation
Introduction to MATLAB for Engineers, Third Edition Chapter 6 Model Building and Regression PowerPoint to accompany Copyright © The McGraw-Hill Companies,
MA2213 Lecture 4 Numerical Integration. Introduction Definition is the limit of Riemann sums I(f)
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
CISE301_Topic11 CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4:
Hydroinformatics: Session4 Dr Ivan Stoianov Room 328B Dr Andrew Ireson (Room 304) Mr Juan Rodriguez-Sanchez (411A) Mr Baback.
Recap Summary of Chapter 6 Interpolation Linear Interpolation.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
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.
Advanced Topics- Polynomials
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
ES 240: Scientific and Engineering Computation. Chapter 13: Linear Regression 13. 1: Statistical Review Uchechukwu Ofoegbu Temple University.
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.
LINEAR ALGEBRA Matrix analysis Linear equations Eigenvalues and singular values Matrix functions.
Mathematical Applications using MATLAB (Cont….)
Analyzing Functions (4.16) y=f(x) MATLAB. Functional Analysis includes: Plotting and evaluating a function Finding extreme points Finding the roots (zeros.
Numerical Analysis 3D Plots. A numerical method is a technique for computing a numerical approximation of the solution to a mathematical problem.
ACSL, POSTECH1 MATLAB 입문 CHAPTER 8 Numerical calculus and differential equations.
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.
Mohiuddin Ahmad SUNG-BONG JANG Interpolation II (8.4 SPLINE INTERPOLATION) (8.5 MATLAB’s INTERPOLATION Functions)
PS 5-3 Integration –Discrete data –Polynomial functions Differentiation –Discrete data –Polynomial functions Roots (i.e., zeros) of functions –Polynomial.
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.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 15 General Least Squares and Non- Linear.
Engineering Applications using MATLAB
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Basis of Mathematical Modeling LECTURE 3 Numerical Analysis with MATLAB Dr. N.K. Sakhnenko, PhD, Professor Associate.
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.
Chapters 5 and 6: Numerical Integration Code development trapezoid rule Simpson’s rule Gauss quadrature Laguerre quadrature Analysis changing the variable.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 13.1 Interpolation between.
Session III Plotting in MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU MATLAB Tutorials.
Interpolation - Introduction
CALCULUS REVIEW BME 3510 C PO-WEI CHEN 8/19/2014.
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.
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
Introduction to Programming for Mechanical Engineers
EEE 244-7: Curve Fitting.
Salinity Calibration fit with MATLAB
Interpolation Estimation of intermediate values between precise data points. The most common method is: Although there is one and only one nth-order.
Chapter 18.
Lecture 10 2D plotting & curve fitting
Chapter 9 Function Approximation
MATH 2140 Numerical Methods
MATH 2140 Numerical Methods
Linear regression Fitting a straight line to observations.
MATH-321 In One Slide MATH-321 & MATLAB Command.
SKTN 2393 Numerical Methods for Nuclear Engineers
Presentation transcript:

Department of Mechanical Engineering, LSU Session IV MATLAB Tutorials Session IV Mathematical Applications using MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU Department of Mechanical Engineering, LSUSession IV

Last Session…. Plotting in MATLAB  2-D Graphics  3-D Graphics  Mesh, surface and contour plots in 3-D plots  Exercises in Graphics

Department of Mechanical Engineering, LSU Session IV Session IV Outline….  Using fplot function  Minimization  Zero finding  Curve fitting  Interpolation  Integration

Department of Mechanical Engineering, LSU Session IV Using fplot() function…. fplot(fun,[xmin, xmax]) plots the function specified by the string fun between the x-axis limits specified by [xmin xmax]. For example fplot(‘sin(x)’,[0 2*pi]) will plot sine of x with x ranging from 0 to 2 . Try it.

Department of Mechanical Engineering, LSU Session IV You can also use fplot for the function defined by yourself. >>fplot(‘function1’,[0 8]) where function1 is a M-file function: fun=‘function1’; fplot(fun,[0 8]) function y=function1(x) y=2*exp(-x).*sin(x); Using fplot() function….

Department of Mechanical Engineering, LSU Session IV Output….

Department of Mechanical Engineering, LSU Session IV Minimization….  In many situations, we want to find the function extremes, the local maximum (peaks) and minimum (valleys).  fmin(fun,x1,x2) can be used to find a local minimum of function f(x) defined by string fun in the interval x1 < x < x2.  In order to find the local maximum, function f(x) should be replaced by -f(x).

Department of Mechanical Engineering, LSU Session IV Example….

Department of Mechanical Engineering, LSU Session IV Zero Finding….  We have learned to use roots to find the zeros of a polynomial.  fzero(fun,x0) can be used to find zero of a general function f(x) near x0.  If you want to solve the equation f(x)=c, just define a function g(x)=f(x)-c. Then find the zero of g(x).

Department of Mechanical Engineering, LSU Session IV Example….

Department of Mechanical Engineering, LSU Session IV Curve Fitting by Polynomial Perform curve fit of N point of data (x i, y i ) (i=1,…N) by a n-th order polynomial For example, n=4, f(x)=a 0 +a 1 *x+a 2 *x^2+a 3 *x^3+a 4 *x^4 Find a 0, …, a 4 which minimize the sum of the squared error at the data points Solve linear equations to find a 0, …, a

Department of Mechanical Engineering, LSU Session IV Using polyfit function….  In Matlab, the function polyfit(x, y, n) finds the coefficients of a polynomial p(x) of degree n that fits the data provided by array x and y in a least-squares sense.  The program on next slide illustrates the use of this function

Department of Mechanical Engineering, LSU Session IV Poly_fit M-File….

Department of Mechanical Engineering, LSU Session IV Output….

Department of Mechanical Engineering, LSU Session IV More on Curve Fitting….  If x and y can be modeled by a power function or exponential function in the form y=a*x^b  y=a*exp(b*x) Taking natural logarithms of both side will yield ln(y)=ln(a)+b*ln(x)  ln(y)=ln(a)+b*x Then we can use the first order polynomial to fit the data and therefore find a and b

Department of Mechanical Engineering, LSU Session IV Interpolation….  Interpolation is defined as a way of estimating values of a function between those given by some set of data points.  The simplest way of interpolation is called linear interpolation in which the intermediate values are calculated by the straight line between the entered points.  Matlab provides function interp1 for one dimensional interpolation.

Department of Mechanical Engineering, LSU Session IV Using interp1 function…. yi = interp1(x,y,xi,'method'), where array x and y provide the data points that are known, yi is the result of interpolation at xi. Available methods are:  'nearest' - nearest neighbor interpolation  'linear' - linear interpolation  'spline' - cubic spline interpolation  'cubic' - cubic interpolation The default is linear interpolation.

Department of Mechanical Engineering, LSU Session IV Example…. Known temperature every hour for twelve hours. Find the temperature at 9.3 and 11.7 using interp1 HoursTemp(C°)

Department of Mechanical Engineering, LSU Session IV M-File….

Department of Mechanical Engineering, LSU Session IV Output in command window….

Department of Mechanical Engineering, LSU Session IV Example 2….

Department of Mechanical Engineering, LSU Session IV Output….

Department of Mechanical Engineering, LSU Session IV Integration…. Many engineering problems require the calculation of the definite integral of a function bounded in the finite interval [a, b]. Numerically, we can approximate the definite integral by the weighted sum of a number of function values

Department of Mechanical Engineering, LSU Session IV Using trapz, quad, quad8 functions….  Matlab provides three function, trapz, quad, quad8, for calculation of integrals.  The function trapz(x, y) calculates the integral by summing the area of trapezoids formed from the data points defined by array x and y  The function quad(fun, a, b) or quadl(fun, a, b) calculate the integral based on the concept of quadrature.

Department of Mechanical Engineering, LSU Session IV Matlab M-File….

Department of Mechanical Engineering, LSU Session IV Output….

Department of Mechanical Engineering, LSU Session IV Recap….  Using fplot function  Minimization  Zero finding  Curve fitting  Interpolation  Integration

Department of Mechanical Engineering, LSU Session IV Next Session…. Ordinary Differential Equations…. Examples using MATLAB to solve ODE’s…. Mention of DDE’s….

Department of Mechanical Engineering, LSU Session IV Thank You