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.type - Function Up: functionfitter - Tool Previous: functionfitter.setfunction - Function


functionfitter.setparameters - Function



Package utility
Module fitting
Tool functionfitter


Set the parameters for your function


Synopsis
setparameters(pars)


Arguments

pars in The parameters to set
    Allowed: Numeric vector


Returns
T or fail



Description

This function sets the parameters of the function that you wish to fit to the data. If you are going to do a linear fit, you don't need to call this function.

If you are going to do a non-linear fit you need to set a guess for the parameters (else they will be zero by default).

When you set parameters, the internally stored Functional tool is updated with the new parameters. Actually doing a fit does not change the values of the parameters. This means that if you wanted to do something like 1) do a fit, 2) set the parameters of the function to the solution and then hold a parameter fixed, and re-fit, you would need to do that explicitly yourself (see example below).



Example
- include 'functionfitter.g'
- x := 1:10                             # Make some data
- y := 2 + 3*x
- ff := functionfitter()                # Create fitter
- ff.setdata(x,y)                       # Set data
- ff.setfunction ('p0 + p1*x')          # Create functional (parameters [0,0])
- sol := ff.fit()                       # Linear fit all parameters solved for
- print sol
[2 3]
- ff.setparameters(1.2*sol)             # Update internal functional parameters
- print ff.fit(fixed=[F,T])             # Hold second parameter fixed  at wrong value
[-1.3 3.6]                              # and drive solution off for first parameter


next up previous contents index
Next: functionfitter.type - Function Up: functionfitter - Tool Previous: functionfitter.setfunction - 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