필터 지우기
필터 지우기

Contour map from hist3()?

조회 수: 2 (최근 30일)
Sandy
Sandy 2013년 6월 14일
댓글: natprice 2015년 3월 5일
Contour map from hist3()?

채택된 답변

Kelly Kearney
Kelly Kearney 2013년 6월 14일
Supply output variables to hist3:
[n,c] = hist3(X, [10 10]);
contour(c{1}, c{2}, n);
  댓글 수: 3
Berks
Berks 2014년 10월 21일
Correction - it should be c{2} before c{1}:
contour(c{2}, c{1}, n)
not sure why - just that it works correctly this way, at least in R2013a.
natprice
natprice 2015년 3월 5일
Correction - it should be the transpose of n
contour(c{1}, c{2}, n.');
Example:
set(gcf,'renderer','opengl');
mu = [2 3];
SIGMA = [1 1.5; 1.5 3];
rng default; % For reproducibility
r = mvnrnd(mu,SIGMA,100);
xb = linspace(min(r(:,1)),max(r(:,1)),20);
yb = linspace(min(r(:,2)),max(r(:,2)),20);
[xx,yy]=meshgrid(xb,yb,20);
[n,c]=hist3(r,{xb yb});
figure()
hold on
plot(r(:,1),r(:,2),'m+')
contour(xx, yy, n.')
hist3(r,{xb yb},'FaceAlpha',.1);
view(3)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by