linfit

From DavinciWiki
Jump to: navigation, search

Description

Line fitting with more details.

Arguments and Return Values

Arguments: Two numeric arrays of any values of the same size

Return Value: A numeric array containing the fitting coefficients, their uncertainties, and estimates of the quality of the fit; also plots fit

Usage

Syntax: linfit(y data, x data)

'y data' - y-axis data (dependent)

'x data' - x-axis data (independent)

The two inputs must have the same dimensions.

The data are fit to the function y = a*x + b

All data are grouped together (into the same fit), so the sizes of the arrays don't matter.

The returned quantities, in order:

First row is y-intercept and slope

Second row is uncertainty of y-intercept and uncertainty of slope, as determined by Higbie 1990 (see http://dx.doi.org/10.1119/1.16607)

Third row is correlation coefficient (R), and standard error in y

If linfit() is entered with no arguments, it prints its description, as shown below.

Examples

dv> linfit()

Detailed linear fit - returns slope, intercept, uncertainties, and more
linfit(y,x) returns an array with the following organization:
 [[y-intercept,           slope              ]
  [intercept uncertainty, slope uncertainty  ]
  [correlation coef. (R), standard error in y]]
Uses least squares
Uncertainty formulae from Higbie 1990
S.Marshall 10-27-2009

0
dv> x = create(11)
11x1x1 array of int, bsq format [44 bytes]
0       1       2       3       4       5       6       7       8       9       10
dv> y = x + 0.1*sin(1000*x)
11x1x1 array of float, bsq format [44 bytes]
0.00000000000000        1.08268797397614        2.09300398826599        3.02191901206970        3.93164968490601        4.90120315551758
5.95722818374634        7.05068874359131        8.09978389739990        9.06154441833496        9.96943855285645
dv> linfit(y, x)
2x3x1 array of double, bsq format [48 bytes]
0.0214644670486450      0.998782517693260
0.0406373144326879      0.00686895983870535
0.999787228243692       0.0720442346444776

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Major Sub-Functions

Related Functions

Recent Library Changes

Created On: 11-18-2009
Modified On: 11-18-2009

Personal tools