Shifting Bivariate Distribution to a New Center

3 Ansichten (letzte 30 Tage)
Thomas Rodriguez
Thomas Rodriguez am 9 Apr. 2022
Kommentiert: Torsten am 10 Apr. 2022
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.

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by