Method ao/lscov
LSCOV is a wrapper for MATLAB's lscov function.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: LSCOV is a wrapper for MATLAB's lscov function. It solves a
set of linear equations by performing a linear least-squares fit. It
solves the problem
Y = HX
where X are the parameters, Y the measurements, and H the linear
equations relating the two.
CALL: X = lscov([C1 C2 ... CN], Y, pl)
X = lscov(C1,C2,C3,...,CN, Y, pl)
INPUTS: C1...CN - AOs which represent the columns of H.
Y - AO which represents the measurement set
Note: the length of the vectors in Ci and Y must be the same.
Note: the last input AO is taken as Y.
pl - parameter list (see below)
OUTPUTs: X - A pest object with fields:
y - the N fitting coefficients to y_i
dy - the parameters' standard deviations (lscov 'STDX' vector)
cov - the parameters' covariance matrix (lscov 'COV' vector)
The procinfo field of the output PEST object is filled with the following key/value
pairs:
'MSE' - the mean-squared errors
Parameters Description
EXAMPLES:
% 1) Determine the coefficients of a linear combination of noises:
% Make some data
fs = 10;
nsecs = 10;
B1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'T'));
B2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'T'));
B3 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'T'));
n = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm'));
c = [ao(1,plist('yunits','m/T')) ao(2,plist('yunits','m/T')) ao(3,plist('yunits','m T^-1'))];
y = c(1)*B1 + c(2)*B2 + c(3)*B3 + n;
y.simplifyYunits;
% Get a fit for c
p_s = lscov(B1, B2, B3, y);
% do linear combination: using lincom
yfit1 = lincom(B1, B2, B3, p_s);
yfit1.simplifyYunits;
% do linear combination: using eval
yfit2 = p_s.eval(B1, B2, B3);
% Plot (compare data with fit)
iplot(y, yfit1, yfit2, plist('Linestyles', {'-','--'}))
% 2) 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', 'T'));
x2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm'));
x3 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'C'));
n = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm'));
c = [ao(1,plist('yunits','m/T')) ao(2,plist('yunits','m/m')) ao(3,plist('yunits','m C^-1'))];
y = c(1)*x1 + c(2)*x2 + c(3)*x3 + n;
y.simplifyYunits;
% Get a fit for c
p_m = lscov(x1, x2, x3, y);
% do linear combination: using lincom
yfit1 = lincom(x1, x2, x3, p_m);
% do linear combination: using eval
pl_split = plist('times', [1 5]);
yfit2 = p_m.eval(plist('Xdata', {split(x1, pl_split), split(x2, pl_split), split(x3, pl_split)}));
% Plot (compare data with fit)
iplot(y, yfit1, yfit2, 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 |
WEIGHTS |
[] |
none |
An ao containing weights for the fit. |
COV |
[] |
none |
An ao containing a covariance matrix for the fit. |
back to top
Some information of the method ao/lscov are listed below: |
Class name |
ao |
Method name |
lscov |
Category |
Signal Processing |
Package name |
ltpda |
VCS Version |
3f8d61c792503a5b5ec8a0a153efb23b65da24a9 |
Min input args |
2 |
Max input args |
-1 |
Min output args |
1 |
Max output args |
-1 |
|
Method: ao/lpsd |
|
Method: ao/ltfe |
 |
©LTP Team