简体   繁体   English

matlab:量化数据并构建直方图

[英]matlab: quantaize data and build an histogram

I have a 3D data (X,Y,Z).我有一个 3D 数据(X、Y、Z)。 Where X is between 0 to 360, Y is between 0 to 180 and Z is between -100 to + 100.其中 X 介于 0 到 360 之间,Y 介于 0 到 180 之间,Z 介于 -100 到 + 100 之间。

I'd like to quantize the data to NxM scale values on X and Y axes respectively and to have some mean value for Z.我想分别将数据量化为 X 和 Y 轴上的 NxM 比例值,并为 Z 设置一些平均值。

This data shall be displayed on 2D plot where the Z values shall be represented by colors (if value is close to 100, then green, if the value is close to -100 then red).该数据应显示在二维图上,其中 Z 值应由颜色表示(如果值接近 100,则为绿色,如果值接近 -100,则为红色)。 How this could be done?这怎么可能?

I've seen that there is a histogram2 function, but it doesn't take into account the z values.我已经看到有一个histogram2函数,但它没有考虑 z 值。

Not exactly sure if you intend to do a histogram specifically but here is one way to plot a set of z values on a xy-plane.不确定您是否打算专门制作直方图,但这是在 xy 平面上绘制一组z值的一种方法。 The plot is created by viewing a 3D surface plot from its top view to give the impression that it is 2D.该图是通过从其顶视图查看 3D 曲面图来创建的,以给人一种 2D 的印象。 The view() function takes to arguments that's used to set the Angle and Elevation the plot is observed from. view()函数接受用于设置观察绘图的AngleElevation的参数。 The colormap() function can be used to set your colours depending on the amplitude/magnitude of variable z . colormap()函数可用于根据变量z的幅度/幅度设置颜色。 Below I used random data as an example.下面我以随机数据为例。

The topic about quantizing data seems like it can be done by using a mean filter on blocks/windows of the z data.关于量化数据的主题似乎可以通过对z数据的块/窗口使用均值滤波器来完成。 This will require more details and clarification.这将需要更多的细节和说明。 Any sample data will be greatly appreciated.任何示例数据将不胜感激。

强度图

x = (0:360); 
y = (0:180);
z = (200*rand(length(y),length(x))) - 100;

[Time_Grid,Depth_Grid] = meshgrid(x,y);

surf(x,y,z);
title("Intensity Plot");
Angle = 0; Elevation = 90;
view(Angle,Elevation);

xlabel("x"); xlim([0,360]); 
ylabel("y"); ylim([0,180]);

red = [1 0 0]; green = [0 1 0]; blue = [0 0 1];

Colour_Palette = [red; blue; blue; blue; green];
colormap(Colour_Palette);
colorbar;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM