How to Generate a 3D Radiation Pattern Line-by-Line Similar to Sens... (2024)

39 views (last 30 days)

Show older comments

thibaut about 5 hours ago

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/2149734-how-to-generate-a-3d-radiation-pattern-line-by-line-similar-to-sensor-array-analyzer-in-matlab

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/2149734-how-to-generate-a-3d-radiation-pattern-line-by-line-similar-to-sensor-array-analyzer-in-matlab

Commented: thibaut about 4 hours ago

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:

  1. 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 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Answers (1)

Abhas about 1 hour ago

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2149734-how-to-generate-a-3d-radiation-pattern-line-by-line-similar-to-sensor-array-analyzer-in-matlab#answer_1509714

Open in MATLAB Online

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:

  1. Iterate Over Angles: Loop through the azimuth and elevation angles to plot each line separately.
  2. Use Plot3: Instead of "surf", use "plot3" to draw lines representing the radiation pattern at each angle.
  3. 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;

How to Generate a 3D Radiation Pattern Line-by-Line Similar to Sens... (3)

You may refer to the following MathWorks documentation links to have a better understanding on plot3 and meshgrid:

  1. https://www.mathworks.com/help/matlab/ref/plot3.html
  2. https://www.mathworks.com/help/matlab/ref/meshgrid.html
1 Comment

Show -1 older commentsHide -1 older comments

thibaut 4 minutes ago

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/2149734-how-to-generate-a-3d-radiation-pattern-line-by-line-similar-to-sensor-array-analyzer-in-matlab#comment_3252664

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/2149734-how-to-generate-a-3d-radiation-pattern-line-by-line-similar-to-sensor-array-analyzer-in-matlab#comment_3252664

Open in MATLAB Online

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

How to Generate a 3D Radiation Pattern Line-by-Line Similar to Sens... (5)

How to Generate a 3D Radiation Pattern Line-by-Line Similar to Sens... (6)

How to Generate a 3D Radiation Pattern Line-by-Line Similar to Sens... (7)

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.

Sign in to comment.

Sign in to answer this question.

See Also

Tags

  • 3d pattern
  • sensor array analyzer

Products

  • Signal Processing Toolbox

Release

R2023b

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


How to Generate a 3D Radiation Pattern Line-by-Line Similar to Sens... (8)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • 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)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

How to Generate a 3D Radiation Pattern Line-by-Line Similar to Sens... (2024)

References

Top Articles
Latest Posts
Article information

Author: Prof. An Powlowski

Last Updated:

Views: 6087

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Prof. An Powlowski

Birthday: 1992-09-29

Address: Apt. 994 8891 Orval Hill, Brittnyburgh, AZ 41023-0398

Phone: +26417467956738

Job: District Marketing Strategist

Hobby: Embroidery, Bodybuilding, Motor sports, Amateur radio, Wood carving, Whittling, Air sports

Introduction: My name is Prof. An Powlowski, I am a charming, helpful, attractive, good, graceful, thoughtful, vast person who loves writing and wants to share my knowledge and understanding with you.