Estimate 2D covariance from 3D matrix where 3rd column contains probability density values
이전 댓글 표시
I have an nx3 matrix where the first 2 columns contain uniformly distributed random (x, y) points and the 3rd column contains pdf values evaluated at each point. The pdf values are computed from a normal distribution using zero mean and a specified covariance. Thus, the first 2 columns are independent while the 3rd column is dependent on the first 2. Here is code that generates a sample matrix:
n = 10000;
mu = [0, 0];
C = [12, 2; 2, 8]; % input covariance
X = [20 * (rand(n,1) - 0.5), 20 * (rand(n,1) - 0.5)]; % centers the grid at (0, 0)
X = [X, zeros(n,1)];
for k = 1:n
p = mvnpdf(X(k,1:2), mu, C); % returns pdf value
X(k,3) = p;
end
My question is how do I estimate the 2x2 covariance matrix that was used to generate my nx3 data? Given that I have the pdf values, it seems like this shouldn't be difficult to do, but I just can't figure out a simple solution.
Many thanks in advance!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!