【发布时间】:2014-12-30 16:18:54
【问题描述】:
我需要了解如何制作我已标准化的数据的 3d 直方图,因此 =1 下的区域。 我有
data=[data_x,data_y];
[HIST,Cent]=hist3(data];
我已阅读以下帖子:
MatLab: Create 3D Histogram from sampled data
但我仍然无法理解该方法。哪位高手可以帮忙解释一下如何在 Matlab 中做到这一点?
编辑:
我使用了以下代码:
load('of.mat')
data=[single(theta(:)),mag(:)];
%define the x and y axis
edges{1} = -180:90:180;
edges{2} = 0:0.2:1;
hist3(data, 'Edges',edges);
[N,C] = hist3(data, 'Edges',edges);
x_diff = diff(edges{1});
y_diff = diff(edges{2});
x = repmat([x_diff, x_diff(end)], length(edges{2}),1)';
y = repmat([y_diff, y_diff(end)], length(edges{1}),1);
% volume of the histogram
V_tot = sum(sum(x.*y.*N));
N_norm = N/V_tot;
figure
% plot normalized histogram
bar3(-C{2}, N_norm');
axis normal
效果很好,但是如何更改归一化直方图上的轴抽动,它的负数和我的数据应该是正数。我的 data_x 介于 -180 和 180(角度)之间,而 data_y 介于 0 和 1 之间。我无法发布图像。
【问题讨论】:
标签: matlab 3d histogram2d