1 / 20

# PH24010 - PowerPoint PPT Presentation

PH24010. MathCAD More Curve Fitting. Previously on PH24010. Linear Fitting slope(), intercept() line() Pre-process Y-data: y = k/x y = e kx. What when can’t pre-process ?. eg. y = a + bx + cx 2 Current through light bulb R changes with heat. linfit().

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' PH24010' - kelly-cox

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### PH24010

More Curve Fitting

• Linear Fitting

• slope(), intercept()

• line()

• Pre-process Y-data:

• y = k/x

• y = ekx

• eg.

• y = a + bx + cx2

• Current through light bulb

• R changes with heat

• Fitting routine for ‘linear’ combinations of functions.

• eg: y = A + B ln(x) + C ex + D x3

Find A,B,C & D to give best fit to data.

• Needs ‘vector of functions’

• Define function of variable x

• Create vector with n rows & 1 column

• Fill placeholders with expressions involving x

• A + B x + C x2

• Call linfit() to get coeffients

• Explicitly put Coeffs into model

• better to use vector maths…(dot product)

• Applications in spectroscopy

• Gaussian peak

• need to find:

• position

• amplitude

• background

• width

• Generalised fit of any function

• Need:

• model function

• partial derivatives of model wrt parameters

• vector of initial guesses for each parameter

• Where:

• y0 is the background level

• m is the x value of the peak centre

• w is the width of the peak at half amplitude

• A is the amplitude of the peak maximum

• Re-write as P0, P1, P2 …

P0 is the background level (y0)

P1 is the amplitude of the peak maximum (A)

P2 is the x value of the peak centre (m)

P3 is the width of the peak at half amplitude (w)

• Use symbolic differentiation

• Function takes 2 parameters:

• Independent variable, x

• Parameter Vector, P

• Re-write P0,P1,P2 etc to use vector subscripts P0, P1, P2

• Function to fit

• dF/dP0

• dF/dP1

• dF/dP2

• dF/dP3

• By inspection of graph

P0 is the background level (y0) = 2

P1 is the amplitude of the peak maximum (A) = 6

P2 is the x value of the peak centre (m) = -3

P3 is the width of the peak at half amplitude (w) = 2

• Form model as before from coeffients & fit function

Use vector subscript to extract correct function from vector function