How to extract a dynamic 2D grid of spatially localised gain values

조회 수: 4 (최근 30일)
Théo
Théo 2023년 9월 1일
댓글: Garmit Pant 2023년 9월 12일
Hello,
I have modelled a dipole antenna and struggled for several days with the documentation before asking my question. I would like to create a grid that runs from the origin of the reference frame to the point (maxWidth, maxHeight) and is located by a third coordinate. The user specifies the position of the antenna phase centre using x0,y0 and z0. So we can have a plane parallel to the axes either X/Y (constant z) or Y/Z (constant x) or X/Z (constant y). I run the grid with a defined step called "mesh_size" here's my code:
x0 = 25.0;
y0 = 25.0;
z0 = 25.0;
frequency = 150000.0;
dipoleAntenna = dipole('Length', 3.0, 'Tilt', 90, 'TiltAxis', [0, 0, 1]); % Tilt vertical et polarisation autour de z
pattern(dipoleAntenna, frequency, 'CoordinateSystem', 'polar');
maxGridWidth = 50.0;
maxGridHeight = 50.0;
mesh_size = 0.1;
num_divisions_width = floor(maxGridWidth / mesh_size);
num_divisions_height = floor(maxGridHeight / mesh_size);
planToDisplay = "X/Z";
thirdcoord = 25.0;
x_coords = 0:mesh_size:maxGridWidth;
y_coords = 0:mesh_size:maxGridHeight;
[X, Y] = meshgrid(x_coords, y_coords);
valueMatrix = zeros(size(X));
for i = 1:length(x_coords)
for j = 1:length(y_coords)
if strcmp(planToDisplay, 'X/Y')
z = thirdcoord - z0;
x = x_coords(i) - x0;
y = y_coords(j) - y0;
elseif strcmp(planToDisplay, 'X/Z')
y = thirdcoord - y0;
x = x_coords(i) - x0;
z = y_coords(j) - z0;
elseif strcmp(planToDisplay, 'Y/Z')
x = thirdcoord - x0;
z = y_coords(j) - z0;
y = x_coords(i) - y0;
end
r = sqrt(x^2 + y^2 + z^2);
if x == 0 && y == 0 && z == 0
Eeff = 25001;
valueMatrix(i, j) = Eeff;
else
[direct, ~, ~] = pattern(dipoleAntenna, frequency, 'Azimuth', atan2(y, x), 'Elevation', acos(z / sqrt(x^2 + y^2 + z^2)));
Eeff = sqrt(30*10000.0*2.0*direct)/r;
valueMatrix(i, j) = Eeff;
end
end
end
I've tried turning the antenna without changing the marker to change the cut without changing my variables, but I'm getting very strange results:
planToDisplay = 'Y/Z';
if strcmp(planToDisplay, 'X/Y')
dipoleAntenna = dipole('Length', 3.0, 'Tilt', 0, 'TiltAxis', [0, 0, 1]); % Tilt vertical et polarisation autour de z
disp(planToDisplay);
elseif strcmp(planToDisplay, 'X/Z')
dipoleAntenna = dipole('Length', 3.0, 'Tilt', 90, 'TiltAxis', [0, 1, 0]); % Tilt horizontal et polarisation autour de y
disp(planToDisplay);
elseif strcmp(planToDisplay, 'Y/Z')
dipoleAntenna = dipole('Length', 3.0, 'Tilt', 90, 'TiltAxis', [1, 0, 0]); % Tilt vertical et polarisation autour de x
disp(planToDisplay);
end
for i = 1:length(x_coords)
for j = 1:length(y_coords)
At least one END is missing. The statement beginning here does not have a matching end.
z = thirdcoord - z0;
x = x_coords(i) - x0;
y = y_coords(j) - y0;
[ ... ]
Thank you in advance for your priceless help !

답변 (1개)

Garmit Pant
Garmit Pant 2023년 9월 11일
Hello Théo
It is my understanding that you have modelled a dipole antenna and want to calculate the directivity values of the signal from the antenna at different points on a 3D plane parallel to different axes.
I have tested the code provided in the post. According to my investigation, the output argument ‘valueMatrix’ stores real, double values as follows for the default antenna configuration provided by you for a plane parallel to the Y-axis.:
Further testing after tilting the antenna gave the following results:
  1. planToDisplay = "X/Y": The output argument ‘valueMatrix’ stores real, double values.
  2. planToDisplay = "X/Z": The output argument ‘valueMatrix’ stores complex double values.
  3. planToDisplay = "Y/Z": The output argument ‘valueMatrix’ stores real, double values.
Complex values are obtained for the case planToDisplay = "X/Z" because the directivity values calculated for the antenna in that plane are negative and the variable ‘Eeff’ is defined as ‘sqrt(30*10000.0*2.0*direct)/r and square root of negative values returns complex values.
In MATLAB, the function ‘pattern’ calculates directivity and returns the values that have the unit as ‘decibel relative to isotropic’(dBi). Directivity is the ratio of the radiation intensity in a given direction from the antenna to the radiation intensity averaged over all directions. Negative decibel values signify that the ratio of radiation intensity in a given direction from the antenna to the radiation intensity averaged over all directions is less than 1. Effectively, it means that the intensity of the radiation in that particular direction is weak and the antenna is not radiating very well at all in that direction in comparison to a dipole. A directional antenna may have good gain in one direction and poor gain in others.
For more information on this, you can refer the following resources :
  1. Refer to the “Output Arguments section. https://in.mathworks.com/help/antenna/ref/fieldanalysiswithfeed.pattern.html
  2. Function 'pattern': https://in.mathworks.com/help/antenna/ref/fieldanalysiswithfeed.pattern.html
I hope this helps! 
  댓글 수: 2
Théo
Théo 2023년 9월 11일
Merci de ton retour ! Concernant le gain négatif je vois effectivement à quoi il correspond et l'erreur vient de moi, en réalité je passe le gain directif en numérique (10^(gain dbi/10)) avant de l'intégrer au sqrt(30*...), ainsi il est toujours positif. Maintenant concernant les coupes je suis en train de voir avec une de vos collègues, merci pour votre aide !
Garmit Pant
Garmit Pant 2023년 9월 12일
It's good to know that my answer was helpful to you!

댓글을 달려면 로그인하십시오.

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by