조회 수: 39 (최근 30일)
이전 댓글 표시
thibaut 대략 5시간 전
댓글: thibaut 대략 4시간 전
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 이전 댓글 -2개 표시이전 댓글 -2개 숨기기
이전 댓글 -2개 표시이전 댓글 -2개 숨기기
댓글을 달려면 로그인하십시오.
이 질문에 답변하려면 로그인하십시오.
답변 (1개)
Abhas 대략 4시간 전
⋮
-
-
링크
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이 답변에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/2149734-how-to-generate-a-3d-radiation-pattern-line-by-line-similar-to-sensor-array-analyzer-in-matlab#answer_1509714
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:
- 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 이전 댓글 -1개 표시이전 댓글 -1개 숨기기
이전 댓글 -1개 표시이전 댓글 -1개 숨기기
thibaut 대략 3시간 전
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/2149734-how-to-generate-a-3d-radiation-pattern-line-by-line-similar-to-sensor-array-analyzer-in-matlab#comment_3252664
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
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.
댓글을 달려면 로그인하십시오.
이 질문에 답변하려면 로그인하십시오.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
지역별 지사에 문의