Skip to content

linearfit.m

Basic Information

  SYNTAX:  [x,norm_error] = linearfit(data)

  PURPOSE:  Do a linear fit to data and return intercept=x(1), slope=x(2).
   Also produce a plot overlaying line on the data for inspection.

  INPUT:
    data = vector of data to fit

  OUTPUT:
    x = intercept x(1) and slope x(2) of a line fit to data
    norm_error = normalized error between data and fitted line

  SEE ALSO: linearfit2

Dependencies