我有如下兩個向量:如何基於值創建色彩映射?
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