Shifting Bivariate Distribution to a New Center

3 ビュー (過去 30 日間)
Thomas Rodriguez
Thomas Rodriguez 2022 年 4 月 9 日
コメント済み: Torsten 2022 年 4 月 10 日
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