Question regarding hist3 fucntion

1 回表示 (過去 30 日間)
John
John 2013 年 1 月 10 日
Hi,
I am using the code below to generate this plot.
The variable data contains acceleration and velocity data.
Is there a way to overwrite the the 0,0 bar (i.e velocity = 0 and acceleration = 0) and set it equal to 0? The height of the 0,0 bar is causing the other bars to appear small.
Appreciate any comments.
% Load data
load Data;
% Create the 3D bar chart
figure;
% Calculate histogram
nBinsX = 10;
nBinsY = 10;
hist3(Data,[nBinsX,nBinsY]);
% Plot histogram
set(gcf,'renderer','opengl');
s = get(gca,'child');
zData = get(s,'zData');
colormap gray;
set(s,...
'zData' ,zData/length(Data),... % normalize frequency
'FaceColor' ,'interp',...
'EdgeColor' ,0.3*[1 1 1],... % make edges visible at all heights
'CDataMode' ,'auto'); % color tops according to height
% Labels
title('Velocity VS Acceleration Distribution');
xlabel('Velocity (mph)');
ylabel('Acceleration (m/s^2)');
zlabel('Normalized Frequency');

採用された回答

José-Luis
José-Luis 2013 年 1 月 10 日
編集済み: José-Luis 2013 年 1 月 10 日
You could remove the data that are close to [0 0] before getting your histogram
If you want to remove values equal to [0 0];
Data = Data(~all(Data,2),:);
If you want to remove values close to [0 0];
your_lim = eps(100); %or some other approximation
Data = Data(all(abs(Data) > your_lim,2),:);
Then you can obtain your histogram.
  2 件のコメント
John
John 2013 年 1 月 10 日
Thank you
José-Luis
José-Luis 2013 年 1 月 10 日
My pleasure.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by