How to find Sigma Matrix for Bivariate Distribution Given Data
Show older comments
Hi,
I'm trying to construct a Bivariate Normal Distribution with Given Data the Location (Lattiude, Longitude).
So far, I have the following code:
xc = 32.7419; % Center of Latitude Coordinate
yc = -117.0904; % Center of Longtitude Coordinate
pop = 72994; % Population at Specified Location
% Creating a 2 dimensional space
x1 = linspace(xc-0.05,xc+0.05,31);
x2 = linspace(yc-0.05,yc+0.05,31);
[X1,X2] = meshgrid(x1,x2);
X = [X1(:) X2(:)];
% Estabilishing Mean Vector,mu & Covariance Matrix,Sigma
mu = [xc yc]
[muHat, Sigma] = normfit(X);
S1 = Sigma(1);
S2 = Sigma(2);
Sigma = [S1 0; 0 S2]
% Sigma = [0.25 0.3; 0.3 1];
% Sigma = [0.85 0.1; 0.1 0.85];
% Evaluating pdf of the normal distribution:
Y = mvnpdf(X,mu,Sigma)*pop;
Y = reshape(Y,length(x2),length(x1));
% Plotting:
figure(1);
surf(x1,x2,Y)
xlabel('x1')
ylabel('x2')
zlabel('Probability Density')
title("Example")
The code produces a distribution, but I would like to create a distribution with minimal standard deviation so that it resembles a "typical" Bivariate Normal Distribution. But I'm having a hard finding a Sigma Matrix that does such.
Accepted Answer
More Answers (0)
Categories
Find more on Uniform Distribution (Continuous) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!