LTPDA Toolbox™ | contents | ![]() ![]() |
Determine the coefficients of a linear combination of noises
fs = 10; nsecs = 10; % fit basis for 2 experiments case B1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'T')); B1.setName; B2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'T')); B2.setName; B3 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'T')); B3.setName; B4 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'T')); B4.setName; C1 = matrix(B1,B2,plist('shape',[2,1])); C1.setName; C2 = matrix(B3,B4,plist('shape',[2,1])); C2.setName; % make additive noise n1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm')); n1.setName; n2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', nsecs, 'yunits', 'm')); n2.setName; % coefficients of the linear combination a1 = ao(1,plist('yunits','m/T')); a1.setName; a2 = ao(2,plist('yunits','m/T')); a2.setName; % assign output values % y is a matrix containing the outputs of two experiments: y1 = a1*B1 + a2*B3 + n1; y2 = a1*B2 + a2*B4 + n2; y = matrix(y1,y2,plist('shape',[2,1]));
% Get a fit with linlsqsvd
pobj = linlsqsvd(C1, C2, y)
---- pest 1 ---- name: a1*C1+a2*C2 param names: {'a1', 'a2'} y: [0.97312642877028477;2.0892132651873916] dy: [0.06611444020240001;0.065007088662104057] yunits: [T^(-1) m][T^(-1) m] pdf: [] cov: [2x2], ([0.00437111920327673 -0.000390118937121542;-0.000390118937121542 0.00422592157632266]) corr: [] chain: [] chi2: 0.85210029717685576 dof: 198 models: matrix(B1/tsdata Ndata=[100x1], fs=10, nsecs=10, t0=1970-01-01 00:00:00.000 UTC, B2/tsdata Ndata=[100x1], fs=10, nsecs=10, t0=1970-01-01 00:00:00.000 UTC), matrix(B3/tsdata Ndata=[100x1], fs=10, nsecs=10, t0=1970-01-01 00:00:00.000 UTC, B4/tsdata Ndata=[100x1], fs=10, nsecs=10, t0=1970-01-01 00:00:00.000 UTC) description: UUID: 545c9699-e749-40d5-bbe1-1322599c9c5d ----------------
% do linear combination: using eval yfit = pobj.eval; % extract objects yfit1 = getObjectAtIndex(yfit,1); yfit2 = getObjectAtIndex(yfit,2); % Plot - compare data with fit iplot(y1, yfit1) iplot(y2, yfit2)
![]() |
Linear least squares with singular value deconposition - single experiment | Iterative linear parameter estimation for multichannel systems - symbolic system model in frequency domain | ![]() |
©LTP Team