17 views

Uploaded by dangerous0

inter

- Computer Oriented Numerical Methods (CONM)2620004
- Tutorial GMS
- Linterp_101_Rev1.1.xls
- Block Modelling
- cv njumail
- onehot
- Ordinary differential equations
- MATLAB Course - Part 2.pdf
- Data Structure Presentation
- Transportation Problems
- NumeericalAnalysis.pdf
- MAT575 2009-1
- Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal Control Problems
- Introduction
- Untitled
- ca-2002
- Winitzki. Uniform Approximations of Transcendental Functions (LNCS)(10s)
- np_annapolis_2001.pdf
- IMAGE DENOISING VIA SELF-LEARNING BASED IMAGE DECOMPOSITION USING DWT
- IRJET- Satellite Image Resolution Enhancement using Dual-tree Complex Wavelet Transform and Non Local Mean

You are on page 1of 12

ChEn 2450

Given (x

i

,y

i

), nd a function f(x)

to interpolate these points.

1 Wednesday, September 18, 13

Motivation & Concept

Motivation:

Often we have discrete data (tabulated,

from experiments, etc) that we need to

interpolate.

Interpolating functions form the basis for

numerical integration and differentiation

techniques

! Used for solving ODEs & PDEs

! we will cover this later

Concept:

Choose a polynomial function to t to

the data (connect the dots)

Solve for the coefcients of the

polynomial

Evaluate the polynomial wherever you

want (interpolation)

T rho lambda viscosity

K kg/m3 W/(m K) N s/m2

----------------------------------------

100 3.5562 0.0093 7.110e-06

150 2.3364 0.0138 1.034e-05

200 1.7458 0.0181 1.325e-05

250 1.3947 0.0223 1.596e-05

300 1.1614 0.0263 1.846e-05

350 0.9950 0.0300 2.082e-05

400 0.8711 0.0338 2.301e-05

450 0.7750 0.0373 2.507e-05

500 0.6864 0.0407 2.701e-05

550 0.6329 0.0439 2.884e-05

600 0.5804 0.0469 3.058e-05

650 0.5356 0.0497 3.225e-05

700 0.4975 0.0524 3.388e-05

750 0.4643 0.0549 3.546e-05

800 0.4354 0.0573 3.698e-05

850 0.4097 0.0596 3.843e-05

900 0.3868 0.0620 3.981e-05

950 0.3666 0.0643 4.113e-05

1000 0.3482 0.0667 4.244e-05

Properties of air at atmospheric pressure

Incropera & DeWitt, Fundamentals of Heat and Mass Transfer, 4th ed.

2 Wednesday, September 18, 13

0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

3.5

4

x

y

linear interp

y=x

2

Linear Interpolation

y = mx +b

y =

y

2

y

1

x

2

x

1

(x x

1

) + y

1

x

y

x

1

y

1

x

2

y

2

Advantages:

Easy to use (homework, exams)

Disadvantages:

Not very accurate for

nonlinear functions

y

1

= mx

1

+b

y

2

= mx

2

+b

Program this into

your calculator.

yi=interp1(x,y,xi,linear)

x - independent variable entries (vector)

y - dependent variable entries (vector)

xi - value(s) where you want to interpolate

yi - interpolated value(s) at xi.

In MATLAB:

x

1

1

x

2

1

m

b

y

1

y

2

into the original equation...

3 Wednesday, September 18, 13

Polynomial Interpolation

Given n+1 data points, we can

t an n

th

-degree polynomial.

Two steps:

1. Obtain polynomial coefcients by

solving the set of linear equations.

2. Evaluate the value of the polynomial

at the desired location (x

i

)

In MATLAB:

p=polyfit(x,y,n)

! Forms & solves the above system.

! requires at least n+1 points

! if you supply more than n+1 points, then

regression will be performed (more later).

yi=polyval(p,xi)

! evaluates polynomial at point(s) given by xi.

Hoffman 4.3

p(x) =

n

p

k=0

a

k

x

k

Given: (x

i

,y

i

), solve for a

i

_

_

1 x

1

x

2

1

x

n

1

1 x

2

x

2

2

x

n

2

.

.

.

.

.

.

.

.

.

.

.

.

1 x

n+1

x

2

n+1

x

n

n+1

_

_

_

_

_

_

_

a

0

a

1

.

.

.

a

n

_

_

_

_

_

=

_

_

_

_

_

y

1

y

2

.

.

.

y

n+1

_

_

_

_

_

4 Wednesday, September 18, 13

T rho lambda viscosity

K kg/m3 W/(m K) N s/m2

----------------------------------------

100 3.5562 0.0093 7.110e-06

150 2.3364 0.0138 1.034e-05

200 1.7458 0.0181 1.325e-05

250 1.3947 0.0223 1.596e-05

300 1.1614 0.0263 1.846e-05

350 0.9950 0.0300 2.082e-05

400 0.8711 0.0338 2.301e-05

450 0.7750 0.0373 2.507e-05

500 0.6864 0.0407 2.701e-05

550 0.6329 0.0439 2.884e-05

600 0.5804 0.0469 3.058e-05

650 0.5356 0.0497 3.225e-05

700 0.4975 0.0524 3.388e-05

750 0.4643 0.0549 3.546e-05

800 0.4354 0.0573 3.698e-05

850 0.4097 0.0596 3.843e-05

900 0.3868 0.0620 3.981e-05

950 0.3666 0.0643 4.113e-05

1000 0.3482 0.0667 4.244e-05

Properties of air at atmospheric pressure

Incropera & DeWitt, Fundamentals of Heat and Mass Transfer, 4th ed.

What is the value

of the viscosity at

T=412 K?

p(x) =

n

p

k=0

a

k

x

k

Can Apply Polynomial Interpolation

Globally or Locally

Linear interpolation (n=1)

Polynomial interpolation, n=2

Polynomial interpolation, n=3

5 Wednesday, September 18, 13

(x1,y1)

(x2,y2)

(x3,y3)

Cubic Spline Interpolation

f

3

(x) = a

3

x

3

+ b

3

x

2

+ c

3

x + d

3

1. At each data point, the values of adjacent splines must be

the same. This applies to all interior points (where two

functions meet) 2(n-1) constraints.

2. At each point, the rst derivatives of adjacent splines must

be equal (applies to all interior points) (n-1) constraints.

3. At each point, the second derivative of adjacent splines must

be equal (applies to all interior points) (n-1) constraints.

4. The rst and last splines must pass through the rst and last

points, respectively 2 constraints.

5. The curvature (d

2

f / dx

2

) must be specied at the end points

2 constraints.

d

2

f / dx

2

= 0 natural spline

4n constraints

f

1

(x) = a

1

x

3

+ b

1

x

2

+ c

1

x + d

1

For n+1 points, we form n splines.

We must specify 4 variables per spline

we need 4n equations.

Concept: use cubic polynomial and hook

them together over a wide range of data...

f

2

(x) = a

2

x

3

+ b

2

x

2

+ c

2

x + d

2

Hoffman 4.9

6 Wednesday, September 18, 13

Cubic Spline Interpolation

Advantages:

Provides a smooth interpolant.

Usually more accurate than linear

interpolation.

Doesnt usually get wiggly like

higher-order polynomial

interpolation can.

Disadvantages:

Requires a bit more work than

linear interpolation to implement.

yi=interp1(x,y,xi,spline)

x - independent variable entries (vector)

y - dependent variable entries (vector)

xi - value(s) where you want to interpolate

yi - interpolated value(s) at xi.

MATLAB

Implementation:

7 Wednesday, September 18, 13

1 0.5 0 0.5 1

0.2

0.4

0.6

0.8

x

f

(

x

)

f(x)

Interpolating Points

Polynomial

Cubic Spline

Linear

1 0.5 0 0.5 1

0.2

0.4

0.6

0.8

x

f

(

x

)

f(x)

Interpolating Points

Polynomial

Cubic Spline

Linear

Comparison Between

Linear, Spline, & Polynomial Interpolation

f(x) = exp

(x + b)

2

c

indistinguishable on this plot.

Increase

number

of data

points.

8 Wednesday, September 18, 13

3 2 1 0 1 2 3

1

0.5

0

0.5

1

x

f

(

x

)

f(x)

Interpolating Points

Polynomial, L

2

=2.6e+03

Cubic Spline, L

2

=9.3e01

Linear, L

2

=7.9e01

Polynomial interpolation can be bad if we use high-order polynomials

f(x) = tanh

x

a

+ exp

(x + b)

2

c

9 Wednesday, September 18, 13

accurate and relatively cost effective.

be adequate for well-resolved data.

unless the underlying data is truly a polynomial!

2 1 0 1 2

20

15

10

5

0

5

10

x

f

(

x

)

f(x)

Interpolating Points

Polynomial

Cubic Spline

Linear

2 1 0 1 2

25

20

15

10

5

0

5

10

15

x

f

(

x

)

f(x)

Interpolating Points

Polynomial

Cubic Spline

Linear

f(x) = x

5

x

4

15x Data points follow

10 Wednesday, September 18, 13

2-D Linear Interpolation

If you have structured (tabular) data:

1. Interpolate in one direction (two 1-D

interpolations)

2. Interpolate in second direction.

Use this for simple homework assignments, in-class

exams, etc.

"=interp2(x,y,",xi,yi,method)

linear - 2D linear interpolation (default)

spline - 2D spline interpolation

I

n

t

e

r

p

o

l

a

t

e

y

r

s

t

I

n

t

e

r

p

o

l

a

t

e

x

r

s

t

x

y

x

1

y

1

x

2

y

2

2,1

2,2

1,2

1,1

x

y

x

1

y

1

x

2

y

2

2,1

2,2

1,2

1,1

B

i

l

i

n

e

a

r

i

n

t

e

r

p

o

l

a

t

i

o

n

x,y may be vectors (matlab assumes tabular form)

" must be a matrix (unique " for each x-y pair)

Hoffman 4.8.1

(x, y)

1,1

(x

2

x)(y

2

y)

(x

2

x

1

)(y

2

y

1

)

+

2,1

(x x

1

)(y

2

y)

(x

2

x

1

)(y

2

y

1

)

+

1,2

(x

2

x)(y y

1

)

(x

2

x

1

)(y

2

y

1

)

+

2,2

(x x

1

)(y y

1

)

(x

2

x

1

)(y

2

y

1

)

11 Wednesday, September 18, 13

General 2-D Linear Interpolation

= ax +by +c

x

y

1

= ax

1

+by

1

+c

2

= ax

2

+by

2

+c

3

= ax

3

+by

3

+c

a =

3

(y

1

y

2

) +

2

(y

3

y

1

) +

1

(y

2

y

3

)

x

3

(y

1

y

2

) + x

2

(y

3

y

1

) + x

1

(y

2

y

3

)

,

b =

3

(x

2

x

1

) +

2

(x

1

x

3

) +

1

(x

3

x

2

)

y

3

(x

2

x

1

) + y

2

(x

1

x

3

) + y

1

(x

3

x

2

)

,

c =

3

(x

1

y

2

x

2

y

1

) +

2

(x

3

y

1

x

1

y

3

) +

1

(x

2

y

3

x

3

y

2

)

x

1

(y

2

y

3

) + x

2

(y

3

y

1

) + x

3

(y

1

y

2

)

"=interp2(x,y,",xi,yi,method)

linear - linear interpolation

spline - spline interpolation

x, y, " are matrices (unique x,y for each ").

Data is NOT

structured

Note: multidimensional higher-

order interpolation methods exist

(e.g. computer graphics industry)

Hoffman 4.8.2

Equation of a plane:

Solve 3

equations for

3 unknowns:

12 Wednesday, September 18, 13

- Computer Oriented Numerical Methods (CONM)2620004Uploaded bymcabca5094
- Tutorial GMSUploaded byNeagu Daniel
- Linterp_101_Rev1.1.xlsUploaded byMuchlis Scumacher D' Bulkibad
- Block ModellingUploaded byEdson Andres Valencia Suaza
- cv njumailUploaded byapi-425293056
- onehotUploaded byPrashanth Mohan
- Ordinary differential equationsUploaded byaaa1235
- MATLAB Course - Part 2.pdfUploaded byApichat Junsod
- Data Structure PresentationUploaded bynannupriya
- Transportation ProblemsUploaded bySudhir Chauhan
- NumeericalAnalysis.pdfUploaded byImrul Ashraf
- MAT575 2009-1Uploaded byWan Fazrin
- Higher-Order Conjugate Gradient Method (HCGM) For Solving Continuous Optimal Control ProblemsUploaded byInternational Organization of Scientific Research (IOSR)
- IntroductionUploaded byShAzan Je
- UntitledUploaded byapi-127299018
- ca-2002Uploaded byHamid Mojiry
- Winitzki. Uniform Approximations of Transcendental Functions (LNCS)(10s)Uploaded bybenjamin_alwes
- np_annapolis_2001.pdfUploaded bythendy
- IMAGE DENOISING VIA SELF-LEARNING BASED IMAGE DECOMPOSITION USING DWTUploaded byijaert
- IRJET- Satellite Image Resolution Enhancement using Dual-tree Complex Wavelet Transform and Non Local MeanUploaded byIRJET Journal
- Runge Kutta MethodUploaded byAbdul Rahim
- B-Tech-SEM-6 ( CE-IT )=20130003Uploaded byVishal Kamlani
- 3Uploaded byjenith
- nextjKnuth-Morris-Pratt (KMP) Algorithm for Pattern MatchingUploaded byAlbateh
- KNN.pptxUploaded byreverseengineer
- UntitledUploaded bySagheer Muhammad
- BISTUploaded byjeevithpaul
- Ch3Uploaded byAhmad Amin
- Solutions 9Uploaded byDaniel Roizen
- k_meanUploaded byJihan Nabila

- Isobutane(R600A) DanfossUploaded byDumitru Podgorneak
- Water Steam ChartUploaded bydangerous0
- Mollier Chart WaterUploaded bychouchou5
- R134a col_common_refridgrant_without_Cl.pdfUploaded byLeonardo Oliveira
- Methane ColUploaded byRodrigo Unzueta
- Drinking Water TreatmentUploaded bytoanvmpetrologx
- Propylene ColUploaded byPaulo Cesar Kirnev
- P-H PropanoUploaded byvlad21
- n Butane ColUploaded byRodrigo Unzueta
- Methane ChartUploaded bydangerous0
- Diagrama P-H EtilenoUploaded byOlga Angeles
- Ethane ColUploaded bydangerous0
- Ammonia P-h ChartUploaded byalimkali
- Ammonia ChartUploaded bydangerous0
- Enthalpy-Entropy Diagram (Air)Uploaded byOng SooShin
- Water Treatment Poster CompleteUploaded bydangerous0
- Waters LCMSWaters LCMS TroubleshootingUploaded bydangerous0
- Triple Trap Safety GuideUploaded bydangerous0
- Mass Spectrometr MassUploaded bydangerous0
- LC-MS-I (intro)Uploaded bydangerous0
- LCMS Trouble ShootingUploaded byLuis Vilchez
- h Plc TroubleshootingUploaded byHarutyun Alaverdyan
- HPLC TroubleshootingUploaded bydangerous0
- Fundamental LC-MS Electrospray Ionisation InstrumentationUploaded bydangerous0
- cms_039797Uploaded bydangerous0
- cms_039793Uploaded bydangerous0
- Chromacademy LCMS IntroUploaded bydangerous0
- api 3200Uploaded bydangerous0
- 221-03 ++Uploaded bydangerous0

- 3. RTU_SASUploaded byNitin Kumar
- Chiral SeparationsUploaded bygeovani2
- Rielly E.conrad. SMP93 - Standard Ship Motion Program User ManualUploaded byYuriyAK
- Lesson 1 - Parts of SpeechUploaded byChiranjivi Naini
- Brain Computer InterfaceUploaded byEr. Amar Kumar
- Inflow PerformanceUploaded byReda Abdel Azim
- Vortex WellUploaded byPirun Sirimangkalo
- 3G Drive Test AnalysisUploaded bybino
- CT BRAIN AnatomyUploaded bydrsalilsidhque
- The Concept of TQMUploaded byAmirul 'Pit'
- Theory of Brown Dwarfs & Giant PlanetsUploaded byrambo_style19
- Financial statement analysis of leading leasing industry in BangladeshUploaded byShahriar Kalam
- Microwave Non-Reciprocal DevicesUploaded byBhavin V Kakani
- Toolbox en USUploaded byjose
- rBasics.pdfUploaded byValdrick
- Hydraulic Cylinder TroubleshootingUploaded bysolidcad
- HB 48-1999 Steel Structures Design HandbookUploaded bySAI Global - APAC
- Asymmetric Flapping Finio IROS 2009(1)Uploaded byMinhaj Akbar
- s71200_system_manual_en-US_en-US.pdfUploaded byVanessa Soria
- Fluent12 Lecture02 Intro to CfdUploaded bypooyasf
- 34-SAMSS-525.pdfUploaded byJensPanosch
- Pressure Ulcers in Patients Hospitalized in Internal Medicine - Associated Factors and MortalityUploaded byDara Agusti Maulidya
- Miller 7th Ed ReviewerUploaded bycloud
- Effect of Anionic Surfactant on SilicaUploaded byalvaroaac4
- Aerospace Propulsion Lec 1 IntroUploaded byNa2ry
- Pro ControlUploaded byntpckaniha
- Clariflocculator Crack WidthUploaded byAnoop Nair
- GATE 2007 – Mechanical Engineering.compressedUploaded byBeesam Ramesh Kumar
- uv4Uploaded bymareklio
- JackknifeUploaded byw108bmg