Why does it give wrong answer?

3 visualizzazioni (ultimi 30 giorni)
Sadiq Akbar
Sadiq Akbar il 31 Dic 2022
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

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by