How to loop through a steering angle range given some array geometry and plot each 3D pattern?

15 ビュー (過去 30 日間)
Noah Wargo
Noah Wargo 2024 年 5 月 3 日
回答済み: Suraj Kumar 2024 年 5 月 23 日
I was watching one of the MATLAB Tech Talk videos about Beamforming, and in it, the speaker showed a clip of the result of a script he created that looped through the azimuth steering angles and smoothly plotted each 3D pattern for that steering angle. I would like to reproduce this but am having trouble in determining how to do this. I've linked the video in question, and I have linked my current code that simply defines my array geometry and plots the array's 3D pattern. I'm relatively sure I can figure out how to loop through the 2D patterns after I figure out how to loop through the 3D pattern. Any help would be greatly appreciated.
Video: What are Phased Arrays? (Go to 15:48)
Code:
% MATLAB Code from Sensor Array Analyzer App
% Generated by MATLAB 23.2 and Phased Array System Toolbox 23.2
% Generated on 03-May-2024 12:59:05
% Create a uniform rectangular array
Array = phased.URA('Size',[4 4],...
'Lattice','Rectangular','ArrayNormal','x');
Array.ElementSpacing = [0.08 0.08];
% Calculate Row taper
rwind = ones(1,4).';
% Calculate Column taper
cwind = ones(1,4).';
% Calculate taper
taper = rwind*cwind.';
Array.Taper = taper.';
% Create an omnidirectional microphone element
Elem = phased.OmnidirectionalMicrophoneElement;
Elem.FrequencyRange = [0 2000];
Array.Element = Elem;
% Assign Frequencies and Propagation Speed
Frequency = 2000;
PropagationSpeed = 343;
steering_azimuth = linspace(-90, 90, 1000);
steering_elevation = linspace(-90, 90, 1000);
% Assign Steering Angles
SteeringAngles = [0;0];
% Assign Phase shift quantization bits
PhaseShiftBits = 0;
% Calculate Steering Weights
Freq3D = 2000;
% Find the weights
w = zeros(getNumElements(Array), length(Frequency));
SteerVector = phased.SteeringVector('SensorArray', Array,...
'PropagationSpeed', PropagationSpeed);
for idx = 1:length(Frequency)
w(:, idx) = step(SteerVector, Frequency(idx), SteeringAngles(:, idx));
end
% Plot 3d graph
format = 'polar';
plotType = 'Directivity';
figure;
pattern(Array, Freq3D , 'PropagationSpeed', PropagationSpeed,...
'CoordinateSystem', format,'weights', w(:,1),...
'ShowArray',false,'ShowLocalCoordinates',true,...
'ShowColorbar',true,'Orientation',[0;0;0],...
'Type', plotType);

回答 (1 件)

Suraj Kumar
Suraj Kumar 2024 年 5 月 23 日
Hi Noah,
To loop through the azimuth steering angles and plot the 3D pattern for each case we can create a steering vector object using the Phased Array System Toolbox which computes the weights needed to steer the arrays beam towards different directions and iterate this through the range of azimuth angles and plot each 3D pattern in a dynamic manner. These weights are a function of frequency, propagation speed of sound and steering angles.
You can refer the following code snippet for better understanding:
fig = figure;
% Loop through azimuth angles to update the plot
for azimuth = azimuthRange
SteeringAngles = [azimuth; elevation];
w = SteerVector(Frequency, SteeringAngles);
clf(fig); % Clear the current figure window before each plot
pattern(Array, Freq3D, 'PropagationSpeed', PropagationSpeed, 'CoordinateSystem', 'polar', ...
'Weights', w, 'ShowArray', false, 'ShowLocalCoordinates', true, ...
'ShowColorbar', true, 'Orientation', [0; 0; 0], 'Type', 'Directivity');
title(sprintf('Azimuth: %d°, Elevation: %d°', azimuth, elevation));
drawnow;
end
For more information about the “SteeringVector” you can refer the following documentation:
  1. https://www.mathworks.com/help/phased/ref/phased.steeringvector-system-object.html
Hope this helps!

カテゴリ

Help Center および File ExchangeGet Started with Phased Array System Toolbox についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by