如何在没有X,Y和Z变量的情况下绘制contourf?

时间:2017-04-12 13:20:56

标签: matlab contourf

我有一个数据集,我想在matlab中绘图。主要数据集是从(Øact - Øcalc)的分析和实验结果获得的两个角度specific analytical angles (Øact: 20, 30, 45, 60, 75, 90, 100 degrees)之间的差异的结果。这些简单的计算是针对不同search radiuses (5 – 25%)的不同resolutions (14 – 224 pixels/diameter)进行的。

我想要做的是绘制角度差(对于每个指定的角度)作为搜索半径和分辨率的函数。即。

Øact – Øcalc = f(search radius, resolution)

我被告知我可以使用contourf()执行此操作,但我被淹没了如何将该功能应用于我的数据,因为我不确定如何关联我的Z to the X and Y grids。无论如何,我尝试了以下代码:

SR  = [5, 10, 15, 20, 25];
res = [14, 28, 56, 112, 224];

angle_diff =  [70, 25, 25, 11, 6.6
               25, 25, 11, 6.6, 6.6
               43.4, 25, 15.5, 11, 10.4
               25, 25, 17.9, 12.3, 12.3
               36.3, 25, 19.3, 16.5, 14.8];


 x = linspace(min(SR), max(SR), 5);
 y = linspace(min(res), max(res), 5);

 [X, Y] = meshgrid(x, y);


% not sure what to do here


 [C, h] = contourf(X, Y, angle_diff);
 clabel(C,h)

但是,我不确定在meshgrid()contourf()之间做什么,以便引入angle_diff

的值

enter image description here

enter image description here

拜托,我需要任何帮助/建议/参考/建议,以便我如何解决这个问题。

我所有其他角度的数据的Excel电子表格将与附图相似:

非常感谢提前。

1 个答案:

答案 0 :(得分:0)

现在我必须手动输入值以获得一些东西。因此,我不介意是否有更好的建议。

% for angle 20 deg.
X = [5 5 5 5 5              % search radius
    10 10 10 10 10
    15 15 15 15 15
    20 20 20 20 20
    25 25 25 25 25];

Y = [14 28 56 112 224       % Resolution
    14 28 56 112 224
    14 28 56 112 224
    14 28 56 112 224
    14 28 56 112 224];

Z = [70 25 25 11 6.6        % theta(act) - theta(calc)
    25 25 11 6.6 6.6
    43.5 25 15.5 11 10.4
    25 25 17.9 12.3 12.3
    36.3 25 19.3 16.5 14.8];

[C, h] = contourf(X, Y, Z, 20);
clabel(C,h)
title('For analytical angle = 20\circ')

c = colorbar;
c.Label.String   = '\thetaact - \thetacalc [\circ]';
c.Label.FontSize = 11;

xlabel('Search radius [% droplet diameter]', 'fontsize',11)
ylabel('Resolution [pixel/diameter]', 'fontsize',11)
相关问题