Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MUSIC Algorithm for Direction Finding

Status
Not open for further replies.

winglj

Full Member level 4
Full Member level 4
Joined
Feb 21, 2005
Messages
195
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Visit site
Activity points
3,063
music algorithm tutorial

Hi, everyone. I have a simple question about the direction finding by using MUSIC Algorithm.

since the antenna array output is:

X=A*F+N

where A is the steering vectors matrix, F is the excitations (complex number???) and N is the noise.

and the covariance matrix of the output X vector is:

S=E(XX*)=AE(FF*)A*+E(NN*)

For given number of incident wave, for example, D incident wave, the F is a fixed vector, and E(FF*) = FF*, therefore its rank is 1. Is it correct?

If possible, would you give me some hints about the numerical code for the MUSIC algorithm?

I am confused how can I construct the E(FF*). Should I use the time average? if so , what is the sampling frequency I should use? Is it larger than the carrier frequency?

Thanks in advance.
 

music direction finding

Refer Array signal processing by Neilson

To construct E(FF*) do u have the signal without noise i mean(F),go for E(XX*). music and espirit of DOA estimation methods coming under subspace methods.
Try understanding subspace methods and orthogonality concepts.
I will try to help with the matlab code for music
 

    winglj

    Points: 2
    Helpful Answer Positive Rating
music algorithm

Hi, deepabhargavi. Thanks for your reply.

I built the MATLAB code and do the test a few days ago. I found that the MUSIC algorithm can detect multiple non-coherent signals only, which although FF* at each sample is rank 1, but the time average SUM(FF*)/Number of Sampling is rank M=Number of Waveform.

When the input waveforms are coherent, for example, several single-frequency sinusoidal plane-wave, the MUSIC algorithm will not be able to distinguish it, since the rank of E(FF*) is always 1.

I am thinking whether there are other "High-Resolution" Algorithms can be used for Direction Finding of multiple coherent signals?

Thanks.
 

Hello,

I want to implement the MUSIC algorithm in MATLAB.

I have found a function for MUSIC [S,w] = pmusic(x,p).

Can any one tell me how i can find the Direction of Arrival


Bilal
 

I want to implement the MUSIC algorithm in MATLAB.

I would strongly advise against using the built-in Matlab functions, as I think it's far easier to write your own functions so you can be sure about what is going on.

I have written some very simple Matlab code for a basic 1D (azimuth only) MUSIC direction of arrival estimation, as many people seem to have trouble getting started with this:

Code:
close all; clear all; clc;


% ======= (1) TRANSMITTED SIGNALS ======= %

% Signal source directions
az = [35;39;127]; % Azimuths
el = zeros(size(az)); % Simple example: assume elevations zero
M = length(az); % Number of sources

% Transmitted signals
L = 200; % Number of data snapshots recorded by receiver
m = randn(M,L); % Example: normally distributed random signals

% ========= (2) RECEIVED SIGNAL ========= %

% Wavenumber vectors (in units of wavelength/2)
k = pi*[cosd(az).*cosd(el), sind(az).*cosd(el), sind(el)].';

% Array geometry [rx,ry,rz]
N = 10; % Number of antennas
r = [(-(N-1)/2:(N-1)/2).',zeros(N,2)]; % Assume uniform linear array

% Matrix of array response vectors
A = exp(-1j*r*k);

% Additive noise
sigma2 = 0.01; % Noise variance
n = sqrt(sigma2)*(randn(N,L) + 1j*randn(N,L))/sqrt(2);

% Received signal
x = A*m + n;

% ========= (3) MUSIC ALGORITHM ========= %

% Sample covariance matrix
Rxx = x*x'/L;

% Eigendecompose
[E,D] = eig(Rxx);
[lambda,idx] = sort(diag(D)); % Vector of sorted eigenvalues
E = E(:,idx); % Sort eigenvalues accordingly
En = E(:,1:end-M); % Noise eigenvectors (ASSUMPTION: M IS KNOWN)

% MUSIC search directions
AzSearch = (0:1:180).'; % Azimuth values to search
ElSearch = zeros(size(AzSearch)); % Simple 1D example

% Corresponding points on array manifold to search
kSearch = pi*[cosd(AzSearch).*cosd(ElSearch), ...
          sind(AzSearch).*cosd(ElSearch), sind(ElSearch)].';
ASearch = exp(-1j*r*kSearch);

% MUSIC spectrum
Z = sum(abs(ASearch'*En).^2,2);

% Plot
figure();
plot(AzSearch,10*log10(Z));
title('Simple 1D MUSIC Example');
xlabel('Azimuth (degrees)');
ylabel('MUSIC spectrum (dB)');
grid on; axis tight;

You can see that the nulls in the spectrum correctly align with the true azimuth directions. Of course, this example is very simple and I am happy to discuss many, many ways that it can be improved. For now, I have put plenty of comments in the code to get people started.
 
My previous post provides a basic implementation of the MUSIC algorithm. What do you need to know more specifically?

If you want my help, please write whole words; "u" and "plz" are not words.
 

My previous post provides a basic implementation of the MUSIC algorithm. What do you need to know more specifically?

If you want my help, please write whole words; "u" and "plz" are not words.

ok..
my work is based on spectrum sensing in cognitive radio.. and i want to implement music algorithm in matlab.. but i am not getting proper work flow. i am confused..
make my way clear for spectrum estimation by music algorithm,,

thank you ..
 

Re: music direction finding

Refer Array signal processing by Neilson

To construct E(FF*) do u have the signal without noise i mean(F),go for E(XX*). music and espirit of DOA estimation methods coming under subspace methods.
Try understanding subspace methods and orthogonality concepts.
I will try to help with the matlab code for music

hi..
how to implement music algorithm for spectrum sensing in cognitive radio..
can you give me some idea?
 

hello sir.. i have doubt

in received signal you have defined..k ..
how you select k?

means i am not getting that you have taken cos and sin term randomly ya thers is some reason behind that?

thank you sir.
 

As stated in my Matlab code, k is the wavenumber vector.

You can find an excellent, concise explanation of the wavenumber vector on pages 5 - 6 of this pdf: link.

Please note:
(1) I hate being called "sir". This is simply not appropriate. You can call me weetabixharry or idiot or pig... but please not "sir".
(2) Please do not copy your posts to me in private messages. I will only respond here in the forum.
 
Weetabixharry i need your help in implementating MUSIC direction finding algorithm in matlab.
 

Please look at my Matlab code above and then let me know if you have any specific questions.
"Weetabixharry as this is the basic 1D code, i need your help for implementing the standard MUSIC code
Regards"
 

"Weetabixharry as this is the basic 1D code, i need your help for implementing the standard MUSIC code
Regards"

What do you mean "standard" MUSIC? In my opinion, standard MUSIC is 1D. (It was originally designed for estimating sinewave frequency, not for direction finding).

What parameters do you want to estimate? Azimuth and elevation? If so, I can easily modify the code for you.
 
weetabixharry:
I have worked many years with LabVIEW for DOA.
Now, I need to apply MUSIC, for Azimuth and Elevation.
Can you help me with Matlab code?

Enildo
 
Last edited by a moderator:

Thank for sharing this piece of code. What if M is not known or set to wrong number? For example, we have 3 real signals, but search for M=10.
 

Thank for sharing this piece of code. What if M is not known or set to wrong number? For example, we have 3 real signals, but search for M=10.

Good question. The MUSIC algorithm requires that M is estimated in advance. However, it has been shown that (using conventional signal models) the problem of estimating M (i.e. the "detection" problem) is fundamentally easier than obtaining distinct direction-of-arrival estimates for those M signals (i.e. the "resolution" problem).

In other words, if the environment parameters (e.g. SNRs, DOAs, number of snapshots, array geometry) could theoretically allow the M signals to be resolved, then it is generally theoretically possible to correctly estimate M. However, the converse is not always true: even if we can estimate M correctly, it does not mean we will be able to resolve the M signals.

Many algorithms exist for estimating M. By far the most popular in the academic literature are the MDL (Minimum Description Length) and AIC (Akaike Information Criterion) algorithms.

- - - Updated - - -

I have worked many years with LabVIEW

I cannot describe how much I hate LabVIEW. It is an absolutely woeful heap of crap. Throw it away and learn to program. You can pick up a programming language in a few months and achieve far more than you ever did in all those years with LabVIEW.

Can you help me with Matlab code?

Sure, no problem.
 
Weetabixharry:
I want to estimate Azimuth and elevation.
Please, modify the code for me.
Thanks in advance.

ecosierra51
 

I want to estimate Azimuth and elevation. Please, modify the code for me.
So, we don't need to change the code much. The most important thing is that we cannot use a linear array to estimate elevation; we must have a 2D or 3D array (this is obvious if you think about the rotational symmetry of a linear array). Therefore, I changed the array to a uniform circular array.

Then, we just have to calculate a separate 1D azimuth spectrum for each elevation. Here is the modified code:


Code Matlab M - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
close all; clear all; clc;
 
 
% ======= (1) TRANSMITTED SIGNALS ======= %
 
% Signal source directions
az = [35;39;127]; % Azimuths
el = [63;14;57]; % Elevations
M = length(az); % Number of sources
 
% Transmitted signals
L = 200; % Number of data snapshots recorded by receiver
m = randn(M,L); % Example: normally distributed random signals
 
% ========= (2) RECEIVED SIGNAL ========= %
 
% Wavenumber vectors (in units of wavelength/2)
k = pi*[cosd(az).*cosd(el), sind(az).*cosd(el), sind(el)].';
 
% Number of antennas
N = 10; 
 
% Array geometry [rx,ry,rz] (example: uniform circular array)
radius = 0.5/sind(180/N);
rx = radius*cosd(360*(0:N-1).'/N);
ry = radius*sind(360*(0:N-1).'/N);
r = [rx, ry, zeros(N,1)];
 
% Matrix of array response vectors
A = exp(-1j*r*k);
 
% Additive noise
sigma2 = 0.01; % Noise variance
n = sqrt(sigma2)*(randn(N,L) + 1j*randn(N,L))/sqrt(2);
 
% Received signal
x = A*m + n;
 
% ========= (3) MUSIC ALGORITHM ========= %
 
% Sample covariance matrix
Rxx = x*x'/L;
 
% Eigendecompose
[E,D] = eig(Rxx);
[lambda,idx] = sort(diag(D)); % Vector of sorted eigenvalues
E = E(:,idx); % Sort eigenvalues accordingly
En = E(:,1:end-M); % Noise eigenvectors (ASSUMPTION: M IS KNOWN)
 
% MUSIC search directions
AzSearch = (0:1:180).'; % Azimuth values to search
ElSearch = (0:1:90); % Elevation values to search
 
% 2D MUSIC spectrum
Z = zeros(length(AzSearch),length(ElSearch));
for i = 1:length(ElSearch)
    % Elevation search value
    el = ElSearch(i);
    
    % Points on azimuth array manifold curve to search (for this el)
    kSearch = pi*[cosd(AzSearch)*cosd(el), ...
              sind(AzSearch)*cosd(el), ...
              ones(size(AzSearch))*sind(el)].';
    ASearch = exp(-1j*r*kSearch);
    
    % Compute azimuth spectrum for this elevation
    Z(:,i) = sum(abs(ASearch'*En).^2,2);
end
 
% Plot
figure();
surf(AzSearch, ElSearch, -10*log10(Z.'/N));
shading interp;
title('2D MUSIC Example');
xlabel('Azimuth (degrees)');
ylabel('Elevation (degrees)');
zlabel('MUSIC spectrum (dB)');
grid on; axis tight;



This produces a 2D spectrum like this:

music2d.png

Note that, for convenient viewing, I plot the negated spectrum. This means that we get peaks at the target directions (instead of nulls), which I find easier to view for the 2D case.

Of course, we don't have to stop at 2D. We can extend, for example, to 3D and 4D to estimate Doppler and time of arrival. This is interesting to experiment with in theory, but in practice a 3D or 4D exhaustive search is far too slow to compute. Instead, we normally find clever ways of reducing the problem (e.g. a 1D search for time of arrival, followed by a 2D azimuth-elevation search is much faster than an exhaustive 3D search).
 
Last edited:
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top