Method ao/bilinfit
BILINFIT is a linear fitting tool
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: BILINFIT linear fitting tool based on MATLAB's lscov
function. It solves an equation in the form
Y = X(1) * P(1) + X(2) * P(2) + ... + P(N+1)
for the fit parameters P. It handles an arbitrary number of input vectors
and uncertainties on the dependent vector Y and input vectors X(1..N).
The output is a pest object where the fields are containing:
Quantity % Field
Fit coefficients y
Uncertainties on the fit parameters
(given as standard deviations) dy
The reduced CHI2 of the fit chi2
The covariance matrix cov
The degrees of freedom of the fit dof
CALL: P = bilinfit(X1, X2, .., XN, Y, PL)
INPUTS: Y - dependent variable
X(1..N) - input variables
PL - parameter list
OUTPUT: P - a pest object with the N+1 elements
PARAMETERS:
'dy' - uncertainty on the dependent variable
'dx' - uncertainties on the input variables
'p0' - initial guess on the fit parameters to propagate uncertainities
in the input variables X(1..N) to the dependent variable Y
Parameters Description
VERSION: $Id: bilinfit.m,v 1.21 2012/01/12 22:43:34 mauro Exp $
EXAMPLES:
% 1) Determine the coefficients of a linear combination of noises:
% Make some data
fs = 10;
nsecs = 10;
x1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm'));
x2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm'));
n = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm'));
c = [ao(1,plist('yunits','m/m')) ao(2,plist('yunits','m/m'))];
y = c(1)*x1 + c(2)*x2 + n;
y.simplifyYunits;
% Get a fit for the c coefficients and a constant term
p = bilinfit(x1, x2, y)
% Do linear combination: using eval
pl_split = plist('times', [1 5]);
yfit = eval(p, split(x1, pl_split), split(x2, pl_split));
% Plot (compare data with fit)
iplot(y, yfit, plist('Linestyles', {'-','--'}))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Method Details |
|
Access |
public |
Defining Class |
ao |
Sealed |
0 |
Static |
0 |
Parameter Description
Sets for this method … |
Default |
Default |
no description |
Key |
Default Value |
Options |
Description |
DY |
[] |
none |
Uncertainty on Y. Can be expressed as- an AO with single value or
- an AO with a vector of the right length or
- a double or
- an array of double of the right length
|
DX |
[] |
none |
Uncertainty on X1 ... XN. Can be expressed as- an array of N AOs with single value or
- an array of N AOs with data vectors of the right length or
- an array of N double
|
P0 |
[] |
none |
Initial guess of the fit parameters. Can be expressed as:- an AOs with a vector
- an array of scalars or
- a pest object
|
back to top
Some information of the method ao/bilinfit are listed below: |
Class name |
ao |
Method name |
bilinfit |
Category |
Operator |
CVS Version |
$Id: bilinfit.m,v 1.21 2012/01/12 22:43:34 mauro Exp $ |
Min input args |
2 |
Max input args |
-1 |
Min output args |
1 |
Max output args |
-1 |
|
Method: ao/any |
|
Method: ao/cat |
 |
©LTP Team