Contour map from hist3()?
4 ビュー (過去 30 日間)
古いコメントを表示
Contour map from hist3()?
0 件のコメント
採用された回答
Kelly Kearney
2013 年 6 月 14 日
Supply output variables to hist3:
[n,c] = hist3(X, [10 10]);
contour(c{1}, c{2}, n);
3 件のコメント
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
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 Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!