39 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
thibaut vor etwa 5 Stunden
Kommentiert: thibaut vor etwa 4 Stunden
Hello MATLAB Community,
I am currently working on visualizing the 3D radiation pattern of an antenna array in MATLAB. I would like to generate this pattern line-by-line in a manner similar to how it is visualized in the Sensor Array Analyzer app.
Here is what I've done so far:
- I've created the array and calculated the directivity in dBi.
- I've plotted the Azimuth ans Elevation Pattern, and it matches the curves from the toolbox.
What I need help with:
- Generating the 3D pattern line-by-line: How can I replicate the line-by-line plotting approach used in Sensor Array Analyzer? Is there a specific function or technique in MATLAB that can help achieve this?
Here is a snippet of the code I am currently using:
matlab
% Example MATLAB code (simplified)
theta = linspace(0, pi, 180); %zenith angle
phi = linspace(-pi, pi, 360); % azimuth angle
[THETA, PHI] = meshgrid(theta, phi);
% Assume AF_magnitude_dBi contains calculated directivity values
X = AF_magnitude_dBi .* sin(THETA) .* cos(PHI);
Y = AF_magnitude_dBi .* sin(THETA) .* sin(PHI);
Z = AF_magnitude_dBi .* cos(THETA);
figure;
surf(X, Y, Z, 'FaceAlpha', 0.8, 'EdgeColor', 'none');
colorbar;
title('3D Radiation Pattern');
xlabel('X');
ylabel('Y');
zlabel('Z');
What modifications or additional steps should I take to generate the pattern and obtain same as in the toolbox?
Any guidance or examples would be greatly appreciated!
Thank you in advance for your help!
0 Kommentare -2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden
-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden
Melden Sie sich an, um zu kommentieren.
Melden Sie sich an, um diese Frage zu beantworten.
Antworten (1)
Abhas vor etwa 5 Stunden
⋮
-
-
Verknüpfen
Direkter Link zu dieser Antwort
https://de.mathworks.com/matlabcentral/answers/2149734-how-to-generate-a-3d-radiation-pattern-line-by-line-similar-to-sensor-array-analyzer-in-matlab#answer_1509714
See AlsoChapter 7, FIR FILTER DESIGN Video Solutions, Digital Signal Processing Using MATLAB | NumeradeChapter 9, Application to Control Video Solutions, Fundamentals of Signals and Systems Using the Web and MATLAB | NumeradeControl Tutorials for MATLAB and SimulinkControl Tutorials for MATLAB and Simulink
In MATLAB Online öffnen
Hi Thibaut,
To generate a 3D radiation pattern line-by-line in MATLAB, similar to the Sensor Array Analyzer app, you can use a combination of plotting techniques. The idea is to iterate over the azimuth and elevation angles, plotting each line individually. You can follow the below steps to do so:
- Iterate Over Angles: Loop through the azimuth and elevation angles to plot each line separately.
- Use Plot3: Instead of "surf", use "plot3" to draw lines representing the radiation pattern at each angle.
- Adjust Transparency and Color: Use properties like "LineWidth" and "Color" to adjust the appearance of each line.
Here's the MATLAB code to reflect the above steps:
% Example MATLAB code with assumed AF_magnitude_dBi
theta = linspace(0, pi, 180); % zenith angle
phi = linspace(-pi, pi, 360); % azimuth angle
[THETA, PHI] = meshgrid(theta, phi);
% Assume AF_magnitude_dBi as a simple cosine pattern for demonstration
AF_magnitude_dBi = 10 * abs(cos(THETA));
X = AF_magnitude_dBi .* sin(THETA) .* cos(PHI);
Y = AF_magnitude_dBi .* sin(THETA) .* sin(PHI);
Z = AF_magnitude_dBi .* cos(THETA);
figure;
hold on;
for i = 1:length(phi)
% Extract line data for a constant azimuth angle
x_line = X(i, :);
y_line = Y(i, :);
z_line = Z(i, :);
% Plot the line
plot3(x_line, y_line, z_line, 'LineWidth', 1.5, 'Color', [0, 0, 1, 0.5]); % Semi-transparent blue lines
end
% Optionally, loop through elevation angles for cross-section lines
for j = 1:length(theta)
% Extract line data for a constant elevation angle
x_line = X(:, j);
y_line = Y(:, j);
z_line = Z(:, j);
% Plot the line
plot3(x_line, y_line, z_line, 'LineWidth', 1.5, 'Color', [1, 0, 0, 0.5]); % Semi-transparent red lines
end
colorbar;
title('3D Radiation Pattern (Line-by-Line)');
xlabel('X');
ylabel('Y');
zlabel('Z');
grid on;
view(3);
hold off;
You may refer to the following MathWorks documentation links to have a better understanding on plot3 and meshgrid:
- https://www.mathworks.com/help/matlab/ref/plot3.html
- https://www.mathworks.com/help/matlab/ref/meshgrid.html
1 Kommentar -1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
thibaut vor etwa 4 Stunden
Direkter Link zu diesem Kommentar
https://de.mathworks.com/matlabcentral/answers/2149734-how-to-generate-a-3d-radiation-pattern-line-by-line-similar-to-sensor-array-analyzer-in-matlab#comment_3252664
In MATLAB Online öffnen
Sorry, my question was not clear!
I want to obtain exactly same plot as with Sensor Array Analyzer but using my formulas to be sure that they are correct. That's why I'm doing a toy exemple with 4 Tx antennas in YZ plane:
With same parameters (frequency, antennas position, space betwenn antennas) in Sensor Array Analyzer, I obtain almost same curves for the cuts but something complitly different for 3D pattern.
% Define your antenna array parameters and call the function
num_ant_X = 1;
num_ant_Y = 2;
num_ant_Z = 2;:
d = 0.5; % Spacing between antennas in wavelength units
c = 3.0e8;
f = 3.5e9;
lambda_0 = c / f;
steering_theta_deg = 90;
steering_phi_deg = 0;
Pattern_array_factor_3d_func(num_ant_X, num_ant_Y, num_ant_Z, lambda_0, d, deg2rad(steering_theta_deg), deg2rad(steering_phi_deg), "omni");
function Pattern_array_factor_3d_func(num_ant_X, num_ant_Y, num_ant_Z, lambda_0, distance_between_antennas_longueur_onde, steering_theta, steering_phi, pattern)
% Calculate the positions of the elements centered around the origin
x_positions = (0:num_ant_X-1) - (num_ant_X - 1) / 2;
y_positions = (0:num_ant_Y-1) - (num_ant_Y - 1) / 2;
z_positions = (0:num_ant_Z-1) - (num_ant_Z - 1) / 2;
x_positions = x_positions * distance_between_antennas_longueur_onde * lambda_0;
y_positions = y_positions * distance_between_antennas_longueur_onde * lambda_0;
z_positions = z_positions * distance_between_antennas_longueur_onde * lambda_0;
% Elevation and azimuth angles
theta = linspace(0, pi, 180);
phi = linspace(-pi, pi, 360);
[THETA, PHI] = meshgrid(theta, phi);
% Array Factor (AF) Initialization
AF = zeros(size(THETA));
% Steering vector components
Us = sin(steering_theta) * cos(steering_phi);
Vs = sin(steering_theta) * sin(steering_phi);
Ws = cos(steering_theta);
% Loop over each antenna element
for x = x_positions
for y = y_positions
for z = z_positions
W = exp(-1j * 2 * pi * (x * Us + y * Vs + z * Ws) / lambda_0);
AF = AF + W .* exp(1j * 2 * pi * (x * sin(THETA) .* cos(PHI) + y * sin(THETA) .* sin(PHI) + z * cos(THETA)) / lambda_0);
end
end
end
% Optional radiation pattern modification (3GPP pattern, etc.)
if strcmp(pattern, "38.901")
radiation_pattern = radiation_pattern_38901(THETA, PHI); % This would need to be defined
AF_global_magnitude_squared = abs(AF).^2 .* radiation_pattern;
else
AF_global_magnitude_squared = abs(AF).^2;
end
AF_global_magnitude_squared_norm = AF_global_magnitude_squared / (num_ant_X * num_ant_Y * num_ant_Z);
% Convert to dBi
AF_magnitude_dBi = 10 * log10(AF_global_magnitude_squared_norm + 0.001);
% Convert to Cartesian coordinates for 3D plot
X = (AF_magnitude_dBi) .* sin(THETA) .* cos(PHI);
Y = (AF_magnitude_dBi) .* sin(THETA) .* sin(PHI);
Z = (AF_magnitude_dBi) .* cos(THETA);
% Plot the 3D radiation pattern
figure;
surf(X, Y, Z, 'FaceAlpha', 0.6, 'EdgeColor', 'none');
colorbar;
title('3D Radiation Pattern');
xlabel('X');
ylabel('Y');
zlabel('Z');
axis equal;
% Extract 2D cut at theta = 90 degrees (elevation pattern)
target_theta = pi / 2;
[~, closest_index_theta] = min(abs(theta - target_theta));
elevation_cut_pattern = AF_magnitude_dBi(:, closest_index_theta);
figure;
polarplot(phi, elevation_cut_pattern);
rlim([min(elevation_cut_pattern) max(elevation_cut_pattern)])
title('Elevation Pattern (dBi)');
% Extract 2D cut at phi = 0 degrees (azimuth pattern)
target_phi = 0;
[~, closest_index_phi] = min(abs(phi - target_phi));
azimuth_cut_pattern = AF_magnitude_dBi(closest_index_phi, :);
figure;
polarplot(theta, azimuth_cut_pattern);
rlim([min(azimuth_cut_pattern) max(azimuth_cut_pattern)])
title('Azimuth Pattern (dBi)');
end
There is a little difference in the values, I don't know why. And for zenith cut, there is a 90° rotation because one is plotting elevation and the other zenith.
Melden Sie sich an, um zu kommentieren.
Melden Sie sich an, um diese Frage zu beantworten.
Es ist ein Fehler aufgetreten
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asien-Pazifik
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Kontakt zu Ihrer lokalen Niederlassung