LeastSq:

Path: Math/Linear

% Weighted least squares curve fit
 Find a weighted least squares curve fit to the overdetermined set of equations

   y = ax 

 where

   a = [x.^e(1), x.^e(2)...] and x are column vectors

 where y and x are inputs and y = f(x).

--------------------------------------------------------------------------
   Form:
   [c, err] = LeastSq( e, y, x, w )
   [c, err] = LeastSq( e, y, x )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   e                  Array of exponents
   y                  Left hand side
   x                  Right hand side
   w                  Weights

   -------
   Outputs
   -------
   c                  Coefficients

--------------------------------------------------------------------------

Back to the Math Module page