genfit

Embed Size (px)

Citation preview

  • 7/26/2019 genfit

    1/2

    F x a,( )

    f x a0, a1,( )

    dfd x a0, a1,( )

    dfd x a0, a1,( )

    :=

    Formulate a vector function that will bethe argument to the "genfit" function.

    dfd x , ,( ) x e x:=

    Next, write down the partial derivatives of

    the function f with respect to the twoparameters of interest, & .

    dfd x , ,( ) e x:=

    f x , ,( ) e x:= This is the fitting function. The coefficient will be negative and |-1/| = is the lifetimefor the radioactive decay.

    Always plot the data before attempting a fit.

    0 20 40 60100

    200

    300

    400

    500

    y

    x

    i 0 n 1..:= we will want to use thisrange variable later

    n 5=number of data pointsn rows x( ):=y

    409

    304

    260

    192

    170

    :=x

    10

    20

    30

    40

    50

    :=

    Raw Data:

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

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

    Nonlinear Regression IIPhysics 258 - DS Hamilton 2004

  • 7/26/2019 genfit

    2/2

    Initial guess for the two parameters. Thisis one reason to plot the data first.

    a500

    0.5

    :=

    Call the function "genfit" to find thebest-fit coefficients.

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

    The solution is:

    505.3= 0.023= 1

    43.392= These are basically identical to those

    found in the "minssd" example.

    t 0 0.1, 60..:= Use this dummy variable to plot the fit so that it looks like asmooth curve through 600 points.

    0 10 20 30 40 50 600

    100

    200

    300

    400

    500

    600

    y

    f t , ,( )

    x t,

    SSD

    i

    yi f xi , ,( )( )2:=

    This is the RMS difference between the data pints andthe fitting function.

    SSD

    n10.1=