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


next up previous contents index
Next: polyfitter.eval - Function Up: polyfitter - Tool Previous: polyfitter.fit - Function


polyfitter.multifit - Function



Package utility
Module mathematics
Tool polyfitter


Fit several sets of data to polynomials


Synopsis
multifit(coeff, coefferrs, chisq, x, y, sigma, order)


Arguments

coeff   The coefficients of the fit. The constant (0th-order) term is first, highest order term last. coeff[,1] are the coefficients for the first fit, coeff[,2] for the second, and so on. (Output)
coefferrs   Estimated errors of the fit. coefferrs[,i] are the errors for the ith fit. (Output)
chisq   $ \chi^{2}_{}$ for the fit. chisq[i] is the chi-square for the i'th fit. (Output)
x   One dimensional array. (Input)
y   Must be the same length as ``x'' in its first axis, the length of the second axis is the number of fits to do. (Input)
sigma   Errors in the ``y'' values. If one dimensional, the sigmas are assumed to be the same for all fits. (Input)
    Default: 1.0
order   Order of the highest term in the polynomial to fit. (Input)
    Allowed: 0$ \le$order$ \le$10
    Default: 1


Returns
Bool -- did the fit succeed


Description
Fits a polynomial to multiple data sets (which must share the same x however)1.2. Basically, this is the same as fit (without an error message - errors are in the log messages), except the dimensionality of all arguments is one higher. This function runs in C++ at the same speed as fit, however it minimizes the communication over the Glish bus, which would limit you to 100 fits or less per second.



Example
  include "polyfitter.g"
T 
  x := 1:100
  y := array(0, 100, 3)
  y[,1] := 5                    # constant
  y[,2] := 2*x                  # linear       
  y[,3] := 10*x*x               # square    
  fitter := polyfitter()
  fitter.multifit(coeff, coefferrs, chisq, x, y, order=2) 
1 
  coeff[,1]                     # the first fit
[5 -2.98023e-08 0]  
  coeff[,2]                     # the second fit
[0.00126371 2 3.93629e-08]  
  coeff[,3]                     # the third fit
[0.00238887 -0.000247818 10]





next up previous contents index
Next: polyfitter.eval - Function Up: polyfitter - Tool Previous: polyfitter.fit - 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