added SINR visualization
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
function f = plotPerformance(obj, altitude, otherSensorsPos, otherSensors)
|
||||
arguments (Input)
|
||||
obj (1, 1) {mustBeA(obj, "rfSensor")};
|
||||
altitude (1, 1) double;
|
||||
otherSensorsPos (:, 3) double = NaN(0, 3);
|
||||
otherSensors (:, 1) cell = cell(0, 1);
|
||||
end
|
||||
arguments (Output)
|
||||
f (1, 1) {mustBeA(f, "matlab.ui.Figure")};
|
||||
end
|
||||
|
||||
% Create grid on which to evalute SINR, SNR
|
||||
agentPos = [0, 0, altitude];
|
||||
d = max(10, max(vecnorm(otherSensorsPos(1:2), 2, 2)) * 1.25);
|
||||
c = 0.1;
|
||||
d = ceil(d / c) * c;
|
||||
distances = -d:c:d;
|
||||
[targetPosX, targetPosY] = meshgrid(distances, distances);
|
||||
|
||||
% Compute SINR, SNR
|
||||
[SINR, SNR] = obj.sensorPerformance(agentPos, [targetPosX(:), targetPosY(:), zeros(size(targetPosX(:)))], otherSensorsPos, otherSensors);
|
||||
SINR = reshape(SINR, size(targetPosX));
|
||||
SNR = reshape(SNR, size(targetPosX));
|
||||
|
||||
% normalize
|
||||
SINR = SINR ./ max(SINR);
|
||||
SNR = SNR ./ max(SNR);
|
||||
|
||||
f = figure;
|
||||
imagesc(SNR);
|
||||
axis("image");
|
||||
colorbar;
|
||||
title("Normalized SNR");
|
||||
|
||||
f = figure;
|
||||
imagesc(SINR);
|
||||
axis("image");
|
||||
colorbar;
|
||||
title("Normalized SINR");
|
||||
|
||||
end
|
||||
@@ -16,9 +16,10 @@ classdef rfSensor
|
||||
|
||||
methods (Access = public)
|
||||
[obj] = initialize(obj, txPower, bandwidth, centerFreq, rxGain); % initialize sensor, define parameters
|
||||
[SINR] = sensorPerformance(obj, agentPos, targetPos, otherSensorsPos, otherSensors); % determine sensor performance for a given single sensor and target geometry
|
||||
[f] = plotParameters(obj); % debug, plot sensor response as a function of distance and tilt angle
|
||||
[SINR, SNR] = sensorPerformance(obj, agentPos, targetPos, otherSensorsPos, otherSensors); % determine sensor performance for a given single sensor and target geometry
|
||||
[d, t, a] = computePointToPoints(obj, agentPos, targetPos);
|
||||
[f] = plotParameters(obj); % debug, plot sensor response as a function of distance and tilt angle
|
||||
[f] = plotPerformance(obj, altitude, otherSensorsPos, otherSensors); % debug, plot SNR or SINR ground heatmap for a given geometry
|
||||
end
|
||||
methods (Access = private)
|
||||
x = RSS(obj, d, t, a); % Received signal strength (function of distance and tilt angle)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function SINR = sensorPerformance(obj, agentPos, targetPos, otherSensorsPos, otherSensors)
|
||||
function [SINR, SNR] = sensorPerformance(obj, agentPos, targetPos, otherSensorsPos, otherSensors)
|
||||
arguments (Input)
|
||||
obj (1, 1) {mustBeA(obj, "rfSensor")};
|
||||
agentPos (1, 3) double;
|
||||
@@ -8,6 +8,7 @@ function SINR = sensorPerformance(obj, agentPos, targetPos, otherSensorsPos, oth
|
||||
end
|
||||
arguments (Output)
|
||||
SINR (:, 1) double;
|
||||
SNR (:, 1) double;
|
||||
end
|
||||
assert(size(otherSensorsPos, 1) == size(otherSensors, 1), "Mismatch in number of other sensor positions (%d) and number of other sensors (%d) provided", size(otherSensorsPos, 1), size(otherSensors, 1));
|
||||
|
||||
@@ -16,10 +17,11 @@ function SINR = sensorPerformance(obj, agentPos, targetPos, otherSensorsPos, oth
|
||||
% Performance is measured as SINR for this sensor
|
||||
S = 10 .^ (0.1 .* obj.RSS(d, t, a)); % Signal
|
||||
I = zeros(size(d)); % Interference from other agents
|
||||
for ii = 1:size(otherSensors, 2)
|
||||
for ii = 1:size(otherSensors, 1)
|
||||
[d_other, t_other, a_other] = otherSensors{ii}.computePointToPoints(otherSensorsPos(ii, 1:3), targetPos);
|
||||
I = I + 10 .^ (0.1 .* otherSensors{ii}.RSS(d_other, t_other, a_other));
|
||||
end
|
||||
|
||||
SINR = 10*log10(S ./ (I + obj.N));
|
||||
SNR = 10*log10(S ./ obj.N);
|
||||
end
|
||||
Reference in New Issue
Block a user