Shifting Bivariate Distribution to a New Center

3 次查看(过去 30 天)
Hello,
I need help shifting the center of a bivariate distribution. Using MATLAB's example,
mu = [0 0];
Sigma = [0.25 0.3; 0.3 1];
x1 = -3:0.2:3;
x2 = -3:0.2:3;
[X1,X2] = meshgrid(x1,x2);
X = [X1(:) X2(:)];
y = mvnpdf(X,mu,Sigma);
y = reshape(y,length(x2),length(x1));
figure(1)
surf(x1,x2,y)
% caxis([min(y(:))-0.5*range(y(:)),max(y(:))])
% axis([-3 3 -3 3 0 0.4])
xlabel('x1')
ylabel('x2')
zlabel('Probability Density')
I would like to shift this distribution to a new center of (2,2). As of now, it's centered at (0,0).
I know that this could be done during the plotting of the distribution. But I would like to shift the entire distribution utilizing the same x1 and x2 arrays.

采纳的回答

Torsten
Torsten 2022-4-9
mu = [2 2];
instead of
mu = [0 0];
  2 个评论
Thomas Rodriguez
Thomas Rodriguez 2022-4-9
Is there a way to shift the distribution without chaning mu? Or is this the only possibility?
Torsten
Torsten 2022-4-10
The center is the mean - so this is the only possibility.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by