will make a linear least squares solution for the points
through the ordinates at the
. The
can be of any dimension, depending on the number of
arguments needed in the functional evaluation. The values should be
given in the order:
arguments.
.
Example
- include 'fitting.g' # create default fitter
- x := [1:10]; # some x values
- y := 3*x*x; # some y values
- dfit.linear(dfs.poly(2), x, y); # solve 2nd order polynomial
T
- dfit.solution();
[0 0 3]
- include 'functionals.g' # allow functionals
- alin := 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.linear(z,x,y) # fit
print '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.linear(z,x,y)
print 'linear:', dfit.solution()
z:=dfs.compiled('6+p0') # try a 0-d functional
x:=[]
print 'y=', y:=z.f([1:3])-2
dfit.linear(z,x,y)
print 'linear:', dfit.solution()
return T
}
- alin()
y= [9 19 29]
linear: [1 2 3]
y= [3 7 11]
linear: [1 2]
y= [4 4 4]
linear: -2
T
Next: fitter.functional - Function
Up: fitter - Tool
Previous: fitter.getstate - 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