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