matlab hist3函数,matlab – 是否有可能使hist3图更平滑?

您可能希望使用

matlab file exchange中的gridfit函数.平滑效果来自插值(更多点到绘图)和完全使用可用颜色(此处为colormap jet).请注意,edgecolor设置为noneso,删除黑线.

在这里使用它,它取hist3(20×20矩阵)的输出并插值(100×100).然后使用冲浪绘制表面.此外,您可以取消注释camlight选项.

final = randn(1000,2)';

n = hist3(final',[20,20]); %binning

figure('Color','w');

%your code with pcolor

subplot(1,2,1);

axis equal;

colormap(jet);

n1 = n';

n1( size(n,1) + 1 ,size(n,2) + 1 ) = 0;

xb = linspace(min(final(:,1)),max(final(:,1)),size(n,1)+1);

yb = linspace(min(final(:,2)),max(final(:,2)),size(n,1)+1);

pcolor(xb,yb,n1)

%density with gridfit function

subplot(1,2,2);

nb_interp_point = 100;

[x,y] = meshgrid(1:size(n,1),1:size(n,2));

zgrid = gridfit(x(:), y(:), n, nb_interp_point, nb_interp_point);

surf(zgrid,'EdgeColor','none')

set(gca,'YDir','reverse');

view(-90,90);

% camlight right

% lighting phong

这是结果

你可能感兴趣的:(matlab,hist3函数)