我有如下两个向量:如何基于值创建色彩映射?
x = 0:5:50;
sir_dB = [50 20 10 5 2 0 -5 -10 -20 -20 -20]
凡x
表示在x轴和sir_dB
的SNR的距离。对于这一点,我需要生成一个彩色地图为50×60米类似于这样一个网格:基于对sir_dB
值
。
我试过如下:
sir_dB = [50 20 10 5 2 0 -5 -10 -20 -20 -20];
xrange = 0:50;
yrange = -30:30;
% create candidate set
[X, Y] = ndgrid(xrange, yrange); % grid of points with a spacing of 1.
candidate_set = [X(:), Y(:)];
test_pt = [0 30];
radius = 5;
% find which of these are within the radius of selected point:
idx = rangesearch(candidate_set, test_pt, radius);
neighborhood = candidate_set(idx{1}, :);
一旦我有5米半径的邻居,我需要的色彩为基础的sir_dB
值相应x
值电网的一部分。
我需要有情节以这样的方式,对于比15 sir_dB
更大所有值,电网应为绿色,黄色为y
大于0,红色y
低于-20更大。
有人可以提供我如何做到最好的输入?
这听起来像你想的'contourf'功能。 – jodag