Plotting multiple patterns of an array

3 Ansichten (letzte 30 Tage)
Muhammad Usman Ghani
Muhammad Usman Ghani am 19 Mai 2020
Beantwortet: Deepak am 6 Nov. 2024
Hello guys,
I wanted to plot the array pattern in both polar and rectangular cordinates from a single code. However matlab plots only the second pattern. Can anyone help me with this? This is the code. I have used the pattern function twice to get both polar and rectangular cordinates result.
% Create a circular planar array
radius = 0.085;
delta = 0.025;
n = round(radius/delta*2);
%htemp = phased.URA(n, delta, ...
% 'Lattice', 'Rectangular');
array = phased.URA;
array.Size = n;
array.ElementSpacing = delta;
array.Lattice = 'Rectangular';
pos = getElementPosition(array);
elemToRemove = sum(pos.^2)>radius^2;
pos(:,elemToRemove) = [];
h = phased.ConformalArray('ElementPosition', pos, ...
'ElementNormal', [1;0]*ones(1,size(pos,2)));
%Calculate Taper
%wind = ones(1,37);
nbar = 2;
sll = -30;
h.Taper = taylortaperc(pos,(0.085*2),nbar,sll);
w = getTaper(h);
viewArray(h,'ShowTaper',true)
%Create Omnidirectional Microphone Element
el = phased.IsotropicHydrophone;
el.BackBaffled = true;
h.Element = el;
%Assign frequencies and propagation speed
F = 30000;
PS = 1500;
%Create figure, panel, and axes
fig = figure;
panel = uipanel('Parent',fig);
hAxes = axes('Parent',panel,'Color','none');
NumCurves = length(F);
%Plot 2d graph
%fmt = 'polar';
cutAngle = 0;
pattern(h, F, -180:180, cutAngle, 'PropagationSpeed', PS, 'Type', ...
'powerdB', 'CoordinateSystem', 'polar' );
pattern(h, F, -180:180, cutAngle, 'PropagationSpeed', PS, 'Type', ...
'powerdB', 'CoordinateSystem', 'rectangular' );
%Create legend
legend_string = cell(1,NumCurves);
lines = findobj(gca,'Type','line');
for idx = 1:NumCurves
[Fval, ~, Fletter] = engunits(F(idx));
legend_string{idx} = [num2str(Fval) Fletter 'Hz; No Steering'];
end
legend(legend_string, 'Location', 'southeast');

Antworten (1)

Deepak
Deepak am 6 Nov. 2024
To achieve the desired result of displaying both polar and rectangular plots of array’s radiation pattern simultaneously, we can use MATLAB’s figure management to separate the plots into distinct figures. This can be accomplished by calling the “figure” function before each plot command.
We can first create a figure for the polar plot and execute the “pattern” function with the “CoordinateSystem” set to “polar”. Then, we can create another figure with the “CoordinateSystem” set to “rectangular”.
Here is the complete MATLAB plot to achieve the same result:
% Create a circular planar array
radius = 0.085;
delta = 0.025;
n = round(radius/delta*2);
array = phased.URA;
array.Size = n;
array.ElementSpacing = delta;
array.Lattice = 'Rectangular';
pos = getElementPosition(array);
elemToRemove = sum(pos.^2) > radius^2;
pos(:,elemToRemove) = [];
h = phased.ConformalArray('ElementPosition', pos, ...
'ElementNormal', [1;0]*ones(1,size(pos,2)));
% Calculate Taper
nbar = 2;
sll = -30;
h.Taper = taylortaperc(pos, (0.085*2), nbar, sll);
w = getTaper(h);
viewArray(h, 'ShowTaper', true);
% Create Omnidirectional Microphone Element
el = phased.IsotropicHydrophone;
el.BackBaffled = true;
h.Element = el;
% Assign frequencies and propagation speed
F = 30000;
PS = 1500;
% Create figure for polar plot
figure;
cutAngle = 0;
pattern(h, F, -180:180, cutAngle, 'PropagationSpeed', PS, 'Type', ...
'powerdB', 'CoordinateSystem', 'polar');
title('Polar Plot');
% Create figure for rectangular plot
figure;
pattern(h, F, -180:180, cutAngle, 'PropagationSpeed', PS, 'Type', ...
'powerdB', 'CoordinateSystem', 'rectangular');
title('Rectangular Plot');
% Create legend
legend_string = cell(1, 1);
[Fval, ~, Fletter] = engunits(F);
legend_string{1} = [num2str(Fval) Fletter 'Hz; No Steering'];
legend(legend_string, 'Location', 'southeast');
Please find attached the documentation of functions used for reference:
I hope this assists in resolving the issue.

Kategorien

Mehr zu Phased Array Design and Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by