41 - 4/24/2000AME 150L1 Solving Engineering Problems, Integrating Equations.

Slides:



Advertisements
Similar presentations
Splines and Piecewise Interpolation
Advertisements

Autar Kaw Benjamin Rigsby Transforming Numerical Methods Education for STEM Undergraduates.
Selected from presentations by Jim Ramsay, McGill University, Hongliang Fei, and Brian Quanz Basis Basics.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
EARS1160 – Numerical Methods notes by G. Houseman
ES 240: Scientific and Engineering Computation. InterpolationPolynomial  Definition –a function f(x) that can be written as a finite series of power functions.
Data mining in 1D: curve fitting
數值方法 2008, Applied Mathematics NDHU 1 Spline interpolation.
Direct Method of Interpolation
Modelling: Curves Week 11, Wed Mar 23
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 23 CURVE FITTING Chapter 18 Function Interpolation and Approximation.
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II.
Lecture 9 Interpolation and Splines. Lingo Interpolation – filling in gaps in data Find a function f(x) that 1) goes through all your data points 2) does.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
Section 8.1 – Systems of Linear Equations
Derivatives and Differential Equations
Matrices Write and Augmented Matrix of a system of Linear Equations Write the system from the augmented matrix Solve Systems of Linear Equations using.
CpE- 310B Engineering Computation and Simulation Dr. Manal Al-Bzoor
1 © 2012 The MathWorks, Inc. Speeding up MATLAB Applications.
Chapter 5. Loops are common in most programming languages Plus side: Are very fast (in other languages) & easy to understand Negative side: Require a.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
Root Finding The solution of nonlinear equations and systems Vageli Coutsias, UNM, Fall ‘02.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves.
Scientific Computing Linear and Quadratic Splines.
Lesson 11-1 Matrix Basics and Augmented Matrices Objective: To learn to solve systems of linear equation using matrices.
Learner’s Guide to MATLAB® Chapter 2 : Working with Arrays.
Unit 3: Matrices.
1 Interpolation. 2 What is Interpolation ? Given (x 0,y 0 ), (x 1,y 1 ), …… (x n,y n ), find the value of ‘y’ at a.
Today’s class Spline Interpolation Quadratic Spline Cubic Spline Fourier Approximation Numerical Methods Lecture 21 Prof. Jinbo Bi CSE, UConn 1.
Splines Vida Movahedi January 2007.
Numerical Methods For Slides Thanks to Lecture 6 Interpolation
Section 9.4 Systems of Linear Equations: Matrices
Slide Copyright © 2009 Pearson Education, Inc. 7.3 Matrices.
Section 4Chapter 4. 1 Copyright © 2012, 2008, 2004 Pearson Education, Inc. Objectives Solving Systems of Linear Equations by Matrix Methods Define.
Computer Programming (TKK-2144) 13/14 Semester 1 Instructor: Rama Oktavian Office Hr.: M.13-15, W Th , F
Recap Cubic Spline Interpolation Multidimensional Interpolation Curve Fitting Linear Regression Polynomial Regression The Polyval Function The Interactive.
3.6 Solving Systems Using Matrices You can use a matrix to represent and solve a system of equations without writing the variables. A matrix is a rectangular.
Mohiuddin Ahmad SUNG-BONG JANG Interpolation II (8.4 SPLINE INTERPOLATION) (8.5 MATLAB’s INTERPOLATION Functions)
1 INTERPOLASI. Direct Method of Interpolation 3 What is Interpolation ? Given (x 0,y 0 ), (x 1,y 1 ), …… (x n,y n ), find the value of ‘y’ at a value.
Copyright © Cengage Learning. All rights reserved. 2 SYSTEMS OF LINEAR EQUATIONS AND MATRICES Warm Up Read pp up to and including the box labeled.
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.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
Designing Parametric Cubic Curves 1. 2 Objectives Introduce types of curves ­Interpolating ­Hermite ­Bezier ­B-spline Analyze their performance.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
Table of Contents Matrices - Definition and Notation A matrix is a rectangular array of numbers. Consider the following matrix: Matrix B has 3 rows and.
Unit 3: Matrices. Matrix: A rectangular arrangement of data into rows and columns, identified by capital letters. Matrix Dimensions: Number of rows, m,
Do Now: Perform the indicated operation. 1.). Algebra II Elements 11.1: Matrix Operations HW: HW: p.590 (16-36 even, 37, 44, 46)
4.1 An Introduction to Matrices Katie Montella Mod. 6 5/25/07.
Precalculus Section 14.1 Add and subtract matrices Often a set of data is arranged in a table form A matrix is a rectangular.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
Introduction to Parametric Curve and Surface Modeling.
11/22/ Differentiation-Discrete Functions.
Computational Methods CMSC/AMSC/MAPL 460 Polynomial Interpolation Ramani Duraiswami, Dept. of Computer Science.
EEE 244-7: Curve Fitting.
Unit 1: Matrices Day 1 Aug. 7th, 2012.
Curve-Fitting Spline Interpolation
Interpolation.
Interpolation Methods
Chapter 15 Curve Fitting : Splines
© University of Wisconsin, CS559 Spring 2004
Spline Interpolation Class XVII.
CT-321 Digital Signal Processing
Splines and Piecewise Interpolation
Interpolation Methods
INTERPOLATION For both irregulary spaced and evenly spaced data.
Introduction to Parametric Curve and Surface Modeling
Theory of Approximation: Interpolation
Presentation transcript:

41 - 4/24/2000AME 150L1 Solving Engineering Problems, Integrating Equations

41 - 4/24/2000AME 150L2 HW 16 - “Sinc Function” The sinc function is common in signal processing (and the signal processing libraries on the student unix cluter have sinc defined)

41 - 4/24/2000AME 150L3 SINC Sin(pi*x)/(pi*x) function SINC(X) returns a matrix whose elements are the sinc of the elements of X, i.e. y = sin(pi*x)/(pi*x) if x ~= 0 = 1 if x == 0 where x is an element of the input matrix and y is the resultant output element.

41 - 4/24/2000AME 150L4 Fortran-ish sinc function y=sinc(x) for k=1:length(x); if x(k)==0 y(k)=1 else y(k)=sin(pi*x(k))/(pi*x(k)) end

41 - 4/24/2000AME 150L5 Dirty Matlab sinc function y=sinc(x) y=sin(pi*(x+2*eps))./(pi*(x+2*eps))    ||||| || ||||| ||||| note./ ||||| Small positive number

41 - 4/24/2000AME 150L6 Elegant Matlab sinc function y=sinc(x) y=ones(size(x)) index=find(x) y(index)=sin(pi*x(index))./... (pi*x(index)) This is used in the signal processing toolbox

41 - 4/24/2000AME 150L7 FIND Find indices of nonzero elements. I = FIND(X) returns the indices of the vector X that are non- zero. For example, I = FIND(A>100), returns the indices of A where A is greater than 100. See RELOP. [I,J] = FIND(X) returns the row and column indices of the nonzero entries in the matrix X. This is often used with sparse matrices. [I,J,V] = FIND(X) also returns a column vector of the nonzero entries in X. Note that find(X) and find(X~=0) will produce the same I and J, but the latter will produce a V with all 1's.

41 - 4/24/2000AME 150L8 Integrals of sin(x)/x quad('sync',0,2,eps)*pi quad8('sync',0,2,eps)*pi dx=x(2)-x(1);y=sync(x); trapz(y)*dx*pi dx= dx= dx= dx=1/8192= smallest possible size in student edition (16384 elements)

41 - 4/24/2000AME 150L9 Sounding Rocket A table of altitude vs. time for a sounding rocket is available Requirement: calculate the velocity and acceleration from the data Use the Matlab function diff

41 - 4/24/2000AME 150L10 DIFF Difference & approximate derivative DIFF(X), for a vector X, is [X(2)-X(1) X(3)-X(2)... X(n)- X(n-1)]. DIFF(X), for a matrix X, is the matrix of column differences, [X(2:n,:) - X(1:n-1,:)]. DIFF(X), for an N-D array X, is the difference along the first non-singleton dimension of X.

41 - 4/24/2000AME 150L11 diff for arrays DIFF(X,N) is the N-th order difference along the first non- singleton dimension (denote it by DIM). If N >= size(X,DIM), DIFF takes successive differences along dimension DIM until size(X,DIM) == 1. DIFF then takes any successive differences along the (M+1) dimension. DIFF(X,N,DIM) is the Nth difference function along dimension DIM. If N >= size(X,DIM), DIFF returns an empty array.

41 - 4/24/2000AME 150L12 Diff - examples h =.001; x = 0:h:pi; diff(sin(x.^2))/h is an approximation to 2*cos(x.^2).*x diff((1:10).^2) is 3:2:19 If X = [ ] then diff(X,1,1) is [ ], diff(X,1,2) is [ ], diff(X,2,2) is the 2nd order difference along the dimension 2, and diff(X,3,2) is the empty matrix.

41 - 4/24/2000AME 150L13 Interpolation Linear - table look-up Spline Interpolation –A Spline is an instrument draftsmen use Spline \Spline\, n. 1. … 2. A long, flexible piece of wood sometimes used as a ruler. Source: Webster's Revised Unabridged Dictionary, © 1996, 1998 MICRA, Inc.

41 - 4/24/2000AME 150L14 Cubic Spline Interpolation Fit a Cubic (4 adjustable constants) to three points, maintaining the slope as continuous as you pass to successive triads. –The curve passes through all of the data –The constants are fixed only over the triad of points –The slope (derivative) varies smoothly

41 - 4/24/2000AME 150L15 SPLINE Cubic spline interpolation YI = SPLINE(X,Y,XI) uses cubic spline interpolation to find a vector YI corresponding to XI. X and Y are the given data vectors and XI is the new abscissa vector XI. PP = SPLINE(X,Y) returns the pp-form of the cubic spline interpolant instead, for later use with ppval, etc.

41 - 4/24/2000AME 150L16 PPVAL Evaluate piecewise polynomial V = PPVAL(PP,XX) returns the value of the piecewise polynomial PP at the points XX. The piecewise polynomial form (pp-form) is returned by SPLINE.

41 - 4/24/2000AME 150L17 Example of a Spline Fit a cubic spline to a coarsely sampled sine » x = 0:10; y = sin(x); » xi = 0:.25:10; » yi = spline(x,y,xi); » plot(x,y,'o',xi,yi),grid,hold » dy=diff(yi)./diff(xi); » for k=1:length(xi)-1;xx(k)=(xi(k+1)+xi(k))/2;end; » plot(xx,dy,'r')