Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: functionfitter.getdata - Function Up: functionfitter - Tool Previous: functionfitter.filter - Function


functionfitter.fit - Function



Package utility
Module fitting
Tool functionfitter


Fit the data


Synopsis
fit(linear, fixed)


Arguments

linear in Linear or non-linear fit ?
    Allowed: T or F
    Default: T
fixed in Fixed parameters mask
    Allowed: Boolean vector
    Default: All parameters fitted


Returns
Vector of float or fail



Description

This function computes and returns the fit of the supplied model to the data.

If you are doing a linear fit, you don't need to set any parameters. If you are doing a non-linear fit, you should supply an initial guess via the setparameters function. Only the data for which the data mask is good (T) will be considered in the fit.

You can also hold parameters fixed in the fit via the argument fixed. You enter a vector of Boolean values (T to hold fixed, F to fit), one for each parameter. By default, all parameters are fitted for.



Example
- include 'functionfitter.g'
- ff := functionfitter()
- x := 1:10
- y := 2 + 3*x
- ff.setdata (x, y)
- ff.setfunction ('p0 + p1*x')
- print ff.fit(linear=T)
[2 3]
-
- ff.setparameters([0,3.2])            # Set function parameters
- print ff.fit(fixed=[F,T])            # Hold second parameter fixed at 3.2
[0.9 3.2]                              # parameter off a bit





next up previous contents index
Next: functionfitter.getdata - Function Up: functionfitter - Tool Previous: functionfitter.filter - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15