2 unknowns in matching datasets
3 views (last 30 days)
I have 3 sets of data and need to find "a" and "b":
there are 2 unknowns so I would need 2 equations to solve this but maybe there is a way to solve this as is? Help please.
DGM on 25 Apr 2022
Edited: DGM on 25 Apr 2022
I'm sure there are other ways, but:
% omit nans
nanmask = ~(isnan(Y1) | isnan(Y2) | isnan(Y3));
Y1 = Y1(nanmask);
Y2 = Y2(nanmask);
Y3 = Y3(nanmask);
% when overdefined, mldivide returns the least-squares solution
ab = [Y2 Y3]\Y1
That said, I'm not sure it's going to be good enough to just blindly process the data. Y1 doesn't look like the linear combination of Y2 and Y3 (at least it doesn't respond events in Y2).
Y1est = [Y2 Y3]*ab; % assume that Y1 is a linear combination
plot(Y2); hold on
plot(Y1); hold on
Some sort of preprocessing is probably warranted here.