Finding one value in matrix from covariance matrix

10 次查看(过去 30 天)
I am new with matlab, but is there any function in matlab to find value V in matrix M by using the covariance matrix C? I have tried inv() in attempt to convert covariance matrix back to the other matrix, but I don't get the same values as in matrix M.
% You have a set of measurements that are gathered into a matrix, such
% that each row of X corresponds to all measurements of a particular type.
% Each column of X corresponds to a set of measurements from one
% particular trial
% matrix
M = [4, V, -21; -3, -2, 5; -7, -3, 10];
% From this, a covariance matrix is computed:
% covariance matrix
C = [249 -50 -96; -50 13 26; -96 26 53];
result = inv(C);

回答(1 个)

dpb
dpb 2021-11-23
编辑:dpb 2021-11-23
There is no solution to the given problem data set -- by definition cov(A) contains the column variances along the diagonal.
Your only variable is V in the second column; hence the column variance of the first column is fixed as
>> var(M(:,1))
ans =
31
>>
One cannot change C(1,1) which will be 31 irrespective of the value of V.
fsolve could probably find a set of values that could/would produce the desired covariance matrix, but it would have to have flexibility to change values in all columns in which the variance of the column doesn't match, none of which do for your particular example datasets.
However, the same logic could be applied to the second column where var(M(:,2)=13
>> fn=@(x)var([x -2 -3])-13; % objective function
>> fsolve(fn,0) % find solution
ans =
3.6847
>> fn(ans)+13 % check -- gets wanted
ans =
13.0000
>>
Now substitute back into M and see what we get...
>> V=3.6847;
>> M = [4, V, -21; -3, -2, 5; -7, -3, 10];
>> cov(M)
ans =
31.0000 19.5541 -90.5000
19.5541 13.0002 -60.0046
-90.5000 -60.0046 277.0000
>>
We have the desired magnitude on the diagonal M(2,2), but NB: that none of the other elements match the given C for this M. Either you've picked mismatched datasets or you're on an impossible mission.

类别

Help CenterFile Exchange 中查找有关 Vector Autoregression Models 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by