will make a non-linear least squares solution for the points
through the ordinates at the
description.
Example
- include 'fitting.g' # create default fitter
- x := [1:10]; # some x values
- y := 3*x*x; # some y values
- dfit.functional(dfs.poly(2), x, y); # solve 2nd order polynomial
T
- dfit.solution();
[-1.10049e-15 7.44482e-16 3]
- include 'functionals.g' # allow functionals
- anonlin := function() { # encapsulate some code
z:=dfs.compiled('p0+p1*x0+p2*x1') # a 2-d functional
x:=[1,2,3,4,5,6] # 3 observations
z.setparameters([1,2,3]) # set parameters to get ys
print 'y=', y:=z.f(x)
dfit.functional(z,x,y) # fit
print 'non-linear:', dfit.solution()
z:=dfs.compiled('p0+p1*x0') # try a 1-d funtional
x:=[1,3,5]
z.setparameters([1,2])
print 'y=', y:=z.f(x)
dfit.functional(z,x,y)
print 'non-linear:', dfit.solution()
z:=dfs.compiled('6+p0') # try a 0-d functional
x:=[]
print 'y=', y:=z.f([1:3])-2
dfit.functional(z,x,y)
print 'non-linear:', dfit.solution()
return T
}
- anonlin()
y= [9 19 29]
non-linear [1 2 3]
y= [3 7 11]
non-linear [1 2]
y= [4 4 4]
non-linear -2
T
Next: fitter.fitavg - Function
Up: fitter - Tool
Previous: fitter.linear - 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