二维图中数据的颜色编码表示(在 MATLAB 中)

Color-coded representation of data in a 2-D plot (in MATLAB)

我有几个 4 x 4 矩阵,其中包含我想在二维图中表示的数据。该图应该显示模拟结果如何随参数变化而变化。

在 y 轴上,我希望获得参数 A 的可能值(在本例中为 [10,20,30,40]),在 x 轴上,我希望获得参数 B 的可能值(在在这种情况下,[2,3,4,5])。 C 是一个 4 x 4 矩阵,其评估值为 运行 具有相应参数组合的模拟。

示例:参数组合 A = 10B = 2 的评估值等于 12 dB。我想在横截面 A 和 B 上绘制它(我希望你明白我的意思)并用粗彩色点对值进行编码(例如,红色表示高值,蓝色表示低值)。

我该怎么做?我基本上想要 mesh 没有线条的东西。

对不起我的英语不完美!我希望你明白我想要达到的目标,提前谢谢你!

您可以使用 mesh command (and the built-in colormaps you can choose from can be found here 执行此操作,或者您甚至可以自己制作):

[A, B] = meshgrid(10:10:40, 2:5);  % Grids of parameter values
C = rand(4);                       % Random sample data
hMesh = mesh(A, B, C);             % Plot a mesh
set(hMesh, 'Marker', '.', ...        % Circular marker
           'MarkerSize', 60, ...     % Make marker bigger
           'FaceColor', 'none', ...  % Don't color the faces
           'LineStyle', 'none');     % Don't render lines
colormap(jet);         % Change the color map
view(0, 90);           % Change the view to look from above
axis([5 45 1.5 5.5]);  % Expand the axes limits a bit
colorbar;              % Add colorbar

剧情如下: