renamed antenna angle states
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
function obj = initialize(obj, txPower, bandwidth, centerFreq, rxGain_dBi, boresightTilt, boresightAzimuth)
|
function obj = initialize(obj, txPower, bandwidth, centerFreq, rxGain_dBi, tilt, azimuth)
|
||||||
arguments (Input)
|
arguments (Input)
|
||||||
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
||||||
txPower (1, 1) double;
|
txPower (1, 1) double;
|
||||||
bandwidth (1, 1) double;
|
bandwidth (1, 1) double;
|
||||||
centerFreq (1, 1) double;
|
centerFreq (1, 1) double;
|
||||||
rxGain_dBi (1, 1) double;
|
rxGain_dBi (1, 1) double;
|
||||||
boresightTilt (1, 1) double = 0;
|
tilt (1, 1) double = 0;
|
||||||
boresightAzimuth (1, 1) double = 0;
|
azimuth (1, 1) double = 0;
|
||||||
end
|
end
|
||||||
arguments (Output)
|
arguments (Output)
|
||||||
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
||||||
@@ -17,8 +17,8 @@ function obj = initialize(obj, txPower, bandwidth, centerFreq, rxGain_dBi, bores
|
|||||||
obj.BW = bandwidth; % Bandwidth (Hz)
|
obj.BW = bandwidth; % Bandwidth (Hz)
|
||||||
obj.f_c = centerFreq; % Center frequency (Hz)
|
obj.f_c = centerFreq; % Center frequency (Hz)
|
||||||
obj.G_RX_dBi = rxGain_dBi; % Receiving Antenna Gain (dBi)
|
obj.G_RX_dBi = rxGain_dBi; % Receiving Antenna Gain (dBi)
|
||||||
obj.boresightTilt = boresightTilt;
|
obj.tilt = tilt;
|
||||||
obj.boresightAzimuth = boresightAzimuth;
|
obj.azimuth = azimuth;
|
||||||
|
|
||||||
% Computed values
|
% Computed values
|
||||||
obj.P_TX_dBm = 10*log10(obj.P_TX/1e-3); % Transmit power in dBm
|
obj.P_TX_dBm = 10*log10(obj.P_TX/1e-3); % Transmit power in dBm
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ classdef rfSensor
|
|||||||
BW = NaN; % Bandwidth (Hz)
|
BW = NaN; % Bandwidth (Hz)
|
||||||
f_c = NaN; % Center frequency (Hz)
|
f_c = NaN; % Center frequency (Hz)
|
||||||
G_RX_dBi = NaN; % Receiver antenna gain
|
G_RX_dBi = NaN; % Receiver antenna gain
|
||||||
boresightTilt = 0; % Antenna boresight tilt (deg): 0=nadir, 90=horizon
|
tilt = NaN; % Antenna boresight tilt (deg): 0=nadir, 90=horizon
|
||||||
boresightAzimuth = 0; % Antenna boresight azimuth (deg): 0=+y, 90=+x
|
azimuth = NaN; % Antenna boresight azimuth (deg): 0=+y, 90=+x, 180=-y, 270=-x
|
||||||
% Values computed at initialization
|
% Values computed at initialization
|
||||||
P_TX_dBm = NaN; % Transmit power (dBm)
|
P_TX_dBm = NaN; % Transmit power (dBm)
|
||||||
N = NaN; % Thermal noise
|
N = NaN; % Thermal noise
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ function value = transmitterGain(obj, t, a)
|
|||||||
|
|
||||||
% Angular offset from boresight via spherical law of cosines
|
% Angular offset from boresight via spherical law of cosines
|
||||||
% Convention: t=0° nadir, t=90° horizon; a=0° +y, a=90° +x
|
% Convention: t=0° nadir, t=90° horizon; a=0° +y, a=90° +x
|
||||||
cos_theta = sind(obj.boresightTilt) .* sind(t) .* cosd(a - obj.boresightAzimuth) + ...
|
cos_theta = sind(obj.tilt) .* sind(t) .* cosd(a - obj.tilt) + ...
|
||||||
cosd(obj.boresightTilt) .* cosd(t);
|
cosd(obj.tilt) .* cosd(t);
|
||||||
cos_theta = max(-1, min(1, cos_theta)); % clamp for numerical safety
|
cos_theta = max(-1, min(1, cos_theta)); % clamp for numerical safety
|
||||||
theta = acosd(cos_theta);
|
theta = acosd(cos_theta);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user