rf sensor parameter and performance plotting improvements
This commit is contained in:
@@ -16,7 +16,7 @@ function [d, t, a] = computePointToPoints(obj, agentPos, targetPos)
|
||||
% distance from sensor nadir to target nadir (i.e. distance ignoring altitude)
|
||||
x = vecnorm(agentPos(1:2) - targetPos(:, 1:2), 2, 2);
|
||||
|
||||
% tilt angle (degrees) (-90, 0 (down), 90)
|
||||
% tilt angle (degrees) (0 (nadir), 180 (zenith))
|
||||
t = (180 - atan2d(x, targetPos(:, 3) - agentPos(3)));
|
||||
|
||||
% azimuth angle (degrees) (0 (+y) clockwise to 360)
|
||||
|
||||
+11
-10
@@ -7,9 +7,9 @@ function f = plotParameters(obj)
|
||||
end
|
||||
|
||||
% Distance and tilt sample points
|
||||
d_values = [0.1, 0.5, 1:1:9, 10:2:19, 20:5:49, 50:10:100];
|
||||
t_values = -90:0.5:90;
|
||||
a_values = 0:0.5:360;
|
||||
d_values = 10.^[1, 2, 3, 4, 5, 6];
|
||||
t_values = 0:2.5:180; % 0=nadir (center), 180=zenith (edge)
|
||||
a_values = 0:2.5:360;
|
||||
|
||||
% Make grid of values of distances and tilts
|
||||
[d_mg, t_mg, a_mg] = meshgrid(d_values, t_values, a_values);
|
||||
@@ -20,17 +20,18 @@ function f = plotParameters(obj)
|
||||
s_x = reshape(s_x, size(d_mg));
|
||||
|
||||
[T, A] = meshgrid(t_values, a_values); % Naz x Nel
|
||||
Tr = deg2rad(T);
|
||||
Ar = deg2rad(A);
|
||||
|
||||
figure;
|
||||
f = figure;
|
||||
hold("on");
|
||||
|
||||
for ii = 1:numel(d_values)
|
||||
% geometry (your "tilt from nadir, stack by distance")
|
||||
X = d_values(ii) * cos(Ar) .* sin(Tr);
|
||||
Y = d_values(ii) * sin(Ar) .* sin(Tr);
|
||||
Z = d_values(ii) * ones(size(X));
|
||||
% Linear radial mapping: t=0 (nadir) -> center, t=180 (zenith) -> edge
|
||||
% Radius in log10 units to match Z axis scale
|
||||
r = log10(d_values(ii)) .* T ./ 180;
|
||||
X = r .* cos(Ar);
|
||||
Y = r .* sin(Ar);
|
||||
Z = log10(d_values(ii)) * ones(size(X));
|
||||
|
||||
% evaluate or extract this slice
|
||||
Fslice = squeeze(s_x(:, ii, :))';
|
||||
@@ -45,7 +46,7 @@ function f = plotParameters(obj)
|
||||
colormap(turbo);
|
||||
colorbar;
|
||||
daspect([1 1 0.2]) % Separate Z further for more distinct layers
|
||||
xlabel('X'); ylabel('Y'); zlabel('Distance (m)');
|
||||
xlabel('X (log_{10} units)'); ylabel('Y (log_{10} units)'); zlabel('log_{10} Distance (m)');
|
||||
set(gca,'ZDir','reverse');
|
||||
view(3);
|
||||
axis("vis3d");
|
||||
|
||||
@@ -13,7 +13,10 @@ function f = plotPerformance(obj, altitude, otherSensorsPos, otherSensors)
|
||||
|
||||
% Create grid on which to evalute SINR, SNR
|
||||
agentPos = [0, 0, altitude];
|
||||
d = max(10, max(vecnorm(otherSensorsPos(1:2), 2, 2)) * 1.25);
|
||||
d = 10;
|
||||
if ~isempty(otherSensorsPos)
|
||||
d = max(d, max(vecnorm(otherSensorsPos(:, 1:2), 2, 2)) * 1.25);
|
||||
end
|
||||
c = 0.1;
|
||||
d = ceil(d / c) * c;
|
||||
distances = -d:c:d;
|
||||
@@ -37,6 +40,7 @@ function f = plotPerformance(obj, altitude, otherSensorsPos, otherSensors)
|
||||
colorbar;
|
||||
xlabel("X (m)"); ylabel("Y (m)");
|
||||
title("Linearly Normalized SNR (dB)");
|
||||
subtitle("No interfering sources");
|
||||
|
||||
nexttile;
|
||||
imagesc(distances, distances, SINR);
|
||||
@@ -44,5 +48,5 @@ function f = plotPerformance(obj, altitude, otherSensorsPos, otherSensors)
|
||||
colorbar;
|
||||
xlabel("X (m)"); ylabel("Y (m)");
|
||||
title("Linearly Normalized SINR (dB)");
|
||||
|
||||
subtitle(sprintf("%d interfering source(s)", size(otherSensorsPos, 1)));
|
||||
end
|
||||
@@ -11,6 +11,11 @@ function value = transmitterGain(obj, t, a)
|
||||
error("t and a must be the same size");
|
||||
end
|
||||
|
||||
% Temporary logic to make nadir-pointing most effective
|
||||
value = 10 .* log10(cosd(t) .^ 2) + 10 .* log10((0.5 + 0.5 .* cosd(a)) .^ 4);
|
||||
n_t = 4; % tilt beamwidth (higher = narrower beam)
|
||||
n_a = 4; % azimuth rolloff sharpness (higher = more directional)
|
||||
|
||||
% Elevation: cardioid family, null at zenith (t=180°), peak at nadir (t=0°)
|
||||
% Azimuth: cardioid family, peak at a=0° (+y), null at a=180° (-y)
|
||||
value = 10 .* n_t .* log10((1 + cosd(t)) ./ 2) + ...
|
||||
10 .* n_a .* log10((0.5 + 0.5 .* cosd(a)));
|
||||
end
|
||||
|
||||
@@ -51,7 +51,6 @@ classdef test_rfSensor < matlab.unittest.TestCase
|
||||
otherSensors{1} = tc.testClass; % One interfering sensor, identical to the main sensor
|
||||
|
||||
tc.testClass.plotPerformance(altitude, otherSensorsPos, otherSensors);
|
||||
|
||||
end
|
||||
|
||||
function plot_SINR_heterogenous_interferers(tc)
|
||||
@@ -74,7 +73,6 @@ classdef test_rfSensor < matlab.unittest.TestCase
|
||||
otherSensors{2} = otherSensors{2}.initialize(100 * P_TX, BW, f_c, G_RX_dBi);
|
||||
|
||||
tc.testClass.plotPerformance(altitude, otherSensorsPos, otherSensors);
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user