cleanup before refactoring

This commit is contained in:
2026-04-21 09:14:38 -07:00
parent dd0861d11c
commit 275123d0fc
5 changed files with 31 additions and 12 deletions
+2 -1
View File
@@ -8,5 +8,6 @@ function value = antennaGain(obj, t)
end
% TODO
value = 10*log10(1);
% Temporary logic to make nadir-pointing most effective
value = 10*log10(cosd(t));
end
+8 -1
View File
@@ -1,9 +1,16 @@
function obj = initialize(obj)
function obj = initialize(obj, txPower, bandwidth, centerFreq)
arguments (Input)
obj (1, 1) {mustBeA(obj, "rfSensor")}
txPower (1, 1) double;
bandwidth (1, 1) double;
centerFreq (1, 1) double;
end
arguments (Output)
obj (1, 1) {mustBeA(obj, "rfSensor")}
end
obj.P_TX = txPower;
obj.BW = bandwidth;
obj.f_c = centerFreq;
end
+1
View File
@@ -9,6 +9,7 @@ function f = plotParameters(obj)
% Distance and tilt sample points
d = [0.01, 0.1, 0.25, 0.5, 0.75, 1:1:100];
t = zeros(size(d));
t = -90:1:90;
% Sample RSS function by distances, tilts
r_x = obj.RSS(d', t');
+4 -4
View File
@@ -5,13 +5,13 @@ classdef rfSensor
k_B = 1.38e-23 % Boltzmann constant (W/Hz/K) for thermal noise model
T_0 = 300; % Ambient temperature (Kelvin) for thermal noise model
% Sensor parameters
P_TX = 10e-3; % Transmit power (Watts)
BW = 1e6; % Bandwidth (Hz)
f_c = 2e9; % Center frequency (Hz)
P_TX = NaN; % Transmit power (Watts)
BW = NaN; % Bandwidth (Hz)
f_c = NaN; % Center frequency (Hz)
end
methods (Access = public)
[obj] = initialize(obj, alphaDist, betaDist, alphaTilt, betaTilt); % TODO initialize sensor, define parameters
[obj] = initialize(obj, txPower, bandwidth, centerFreq); % TODO initialize sensor, define parameters
[SINR] = sensorPerformance(obj, agentPos, agentPan, agentTilt, targetPos); % 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
end
+16 -6
View File
@@ -8,18 +8,28 @@ classdef test_rfSensor < matlab.unittest.TestCase
function tc = setup(tc)
% Reinitialize sensor with random parameters
tc.testClass = rfSensor;
% TODO
tc.testClass = tc.testClass.initialize();
end
end
methods (Test)
% Test methods
function plot_SNR(tc)
% Plot sensor performance with no sources of interference
P_TX = 1e-3; % Transmit power (Watts)
BW = 20e6; % Bandwidth (Hz)
f_c = 2e9; % Center frequency (Hz)
tc.testClass = tc.testClass.initialize(P_TX, BW, f_c);
function test_SINR(tc)
tc.testClass.plotParameters();
% [SINR] = tc.testClass.sensorPerformance(obj, agentPos, agentPan, agentTilt, targetPos);
end
end
function plot_SINR(tc)
% Plot sensor performance with a single source of interference
P_TX = 1e-3; % Transmit power (Watts)
BW = 20e6; % Bandwidth (Hz)
f_c = 2e9; % Center frequency (Hz)
tc.testClass = tc.testClass.initialize(P_TX, BW, f_c);
end
end