0% found this document useful (0 votes)
114 views2 pages

Genfit

This document describes using a generalized least-squares fitting procedure in Mathcad to find the optimal fit parameters for an exponential decay model of radioactive material. It provides raw data of elapsed time and radiation counts. It defines an exponential decay fitting function and calculates its partial derivatives. The genfit function is called to find the best-fit coefficients for the rate and lifetime, which are close to values found in another example. A plot shows the fitted exponential curve matches the data well with a small summed squared difference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views2 pages

Genfit

This document describes using a generalized least-squares fitting procedure in Mathcad to find the optimal fit parameters for an exponential decay model of radioactive material. It provides raw data of elapsed time and radiation counts. It defines an exponential decay fitting function and calculates its partial derivatives. The genfit function is called to find the best-fit coefficients for the rate and lifetime, which are close to values found in another example. A plot shows the fitted exponential curve matches the data well with a small summed squared difference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Nonlinear Regression II

Physics 258 - DS Hamilton 2004

This example worksheet uses a generalized least-squares fitting procedure that is built into
Mathcad to find the optimal fit parameters for an arbitrary (nonlinear) model function.

The data is from Taylor 2nd ed, problem 8.25. The rate at which a radioactive material emits
radiation (and number of remaining radioactive nuclei) is expected to decrease exponentially
with time. The two data vectors are "x", the elapsed time t (in min), and "y": the number of
counts in a 15-second interval.
Raw Data:

10
20

x := 30
40

50

409
304

y := 260
192

170

n := rows ( x)
n=5

number of data points

i := 0 .. n 1

we will want to use this


range variable later

500
400
y

Always plot the data before attempting a fit.

300
200
100

20

40

60

f( x , , ) := e

This is the fitting function. The coefficient


will be negative and |-1/| = is the lifetime
for the radioactive decay.

dfd ( x , , ) := e

dfd ( x , , ) := x e

f( x , a0 , a1)

F ( x , a) := dfd ( x , a0 , a1)
dfd x , a , a
( 0 1)

Next, write down the partial derivatives of


the function f with respect to the two
parameters of interest, & .

Formulate a vector function that will be


the argument to the "genfit" function.

500

0.5

a :=

Initial guess for the two parameters. This


is one reason to plot the data first.


:= genfit( x , y , a , F)

Call the function "genfit" to find the


best-fit coefficients.

The solution is:

= 505.3

= 0.023

t := 0 , 0.1 .. 60

= 43.392

These are basically identical to those


found in the "minssd" example.

Use this dummy variable to plot the fit so that it looks like a
smooth curve through 600 points.

600
500
400
y
f (t , , )

300
200
100
0

10

20

30

40

50

60

x, t

SSD :=

( yi f( xi , , ) )

SSD
= 10.1
n

This is the RMS difference between the data pints and


the fitting function.

You might also like