Why does it give wrong answer?

2 次查看(过去 30 天)
Sadiq Akbar
Sadiq Akbar 2022-12-31
回答: Umeshraja 2024-10-8
I took a code from the Mathworks site given below:
N = 10;
d = 0.5;
elementPos = (0:N-1)*d;
angles = [0 -25 30];
Nsig = 3;
R = sensorcov(elementPos,angles,db2pow(-5));
doa = rootmusicdoa(R,Nsig)
It works well. But when I change the 'elementPos' from linear to L-shaped array and change the angles vector to a 2 x M matrix so that to find both the angles (azimuth as well as the elevation), then it gives m the wrong answer. My modified code is as below:
clear al; clc
N = 10;
d = 0.5;
% elementPos = (0:N-1)*d;
elementPos = L1_Array(N-1);
elementPos=elementPos';
% angles = [0 -25 30];
angles = [-30 0 30; 10 20 40];
Nsig = 3;
R = sensorcov(elementPos,angles,db2pow(-5));
doa = rootmusicdoa(R,Nsig)
function r=L1_Array(N)
d = 0.5;%Inter-element spacing
rx = [(N-1)/2*d:-d:d,zeros(1,(N+1)/2)].';
ry = [zeros(1,(N+1)/2),d:d:(N-1)/2*d].';
r = [rx,ry,zeros(N,1)];
end
As can be seen, the azimuth angles are -30 0 and 30 while elevation angles are 10 20 and 40. But when I run this code, it gives me the following wrong answer:
doa =
-41.4097 -22.9068 -73.0831

回答(1 个)

Umeshraja
Umeshraja 2024-10-8
As per latest MATLAB Documentation, the "rootmusicdoa" function is primarily designed for Uniform Linear Arrays (ULA) and may not work with non-linear arrays like L-shaped configurations.
For such cases, you could use the "phased.MUSICEstimator2D" function from MATLAB's Phased Array System Toolbox, which is capable of handling 2D or 3D planar arrays.
Here's an example demonstrating how to estimate the DOA for an L-shaped array where a signal arrives from -37° azimuth and 0° elevation:
doa = [-37; 0]; % Azimuth and elevation angles
fc = 150e6;
c = physconst('LightSpeed');
lam = c/fc;
fs = 8000;
f = 450.0;
% Create element positions for the L-shaped array
N1 = 5; % Number of elements in the first arm of the L
N2 = 4; % Number of elements in the second arm of the L (excluding corner)
d = lam/2; % Element spacing in meters
% First arm along the x-axis
xPos1 = (0:N1-1) * d;
yPos1 = zeros(1, N1);
zPos1 = zeros(1, N1);
% Second arm along the y-axis (starting from d to avoid overlap)
xPos2 = zeros(1, N2);
yPos2 = (1:N2) * d;
zPos2 = zeros(1, N2);
% Concatenate positions
xPos = [xPos1, xPos2];
yPos = [yPos1, yPos2];
zPos = [zPos1, zPos2];
% Create conformal array
array = phased.ConformalArray('ElementPosition', [xPos; yPos; zPos]);
array.Element.FrequencyRange = [50.0e6 500.0e6];
figure;
viewArray(array);
title('L-Shaped Planar Array of Isotropic Antennas');
array.Element.FrequencyRange = [50.0e6 500.0e6];
% Generate signal
t = (0:1/fs:1).';
x1 = cos(2*pi*t*f);
%Simulate received signals at the sensor array
x = collectPlaneWave(array,x1,doa,fc);
noise = 0.1*(randn(size(x))+1i*randn(size(x)));
% Estimate DOA using MUSIC
estimator = phased.MUSICEstimator2D('SensorArray', array, ...
'OperatingFrequency', fc, ...
'NumSignalsSource', 'Property', ...
'DOAOutputPort', true, ...
'NumSignals', 1, ...
'AzimuthScanAngles', -50:0.5:50, ...
'ElevationScanAngles', -30:0.5:30);
[~,doa]=estimator(x + noise)
doa = 2×1
-37.0000 -0.5000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
% Plot the spectrum
figure;
plotSpectrum(estimator);
Please refer to the following documentation to know more

Community Treasure Hunt

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

Start Hunting!

Translated by