- 10th November 2006, 19:13 #1

- Join Date
- Feb 2005
- Posts
- 195
- Helped
- 1 / 1
- Points
- 2,910
- Level
- 12

## 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.

- 10th November 2006, 19:13

- 14th November 2006, 12:07 #2

- Join Date
- Nov 2006
- Posts
- 20
- Helped
- 1 / 1
- Points
- 1,584
- Level
- 9

## 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

1 members found this post helpful.

- 20th November 2006, 06:28 #3

- Join Date
- Feb 2005
- Posts
- 195
- Helped
- 1 / 1
- Points
- 2,910
- Level
- 12

## 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.

- 22nd November 2011, 14:48 #4

- Join Date
- Nov 2011
- Posts
- 2
- Helped
- 0 / 0
- Points
- 198
- Level
- 2

## Re: MUSIC Algorithm for Direction Finding

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

- 13th October 2013, 19:53 #5

- Join Date
- Oct 2013
- Posts
- 162
- Helped
- 54 / 54
- Points
- 1,181
- Level
- 7
- Blog Entries
- 5

## Re: MUSIC Algorithm for Direction Finding

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;

1 members found this post helpful.

- 15th January 2014, 19:03 #6

- Join Date
- Nov 2013
- Posts
- 14
- Helped
- 0 / 0
- Points
- 115
- Level
- 1

## Re: MUSIC Algorithm for Direction Finding

hi..

will u help me for implementation of music algorithm? plz..

- 16th January 2014, 21:41 #7

- Join Date
- Oct 2013
- Posts
- 162
- Helped
- 54 / 54
- Points
- 1,181
- Level
- 7
- Blog Entries
- 5

## Re: MUSIC Algorithm for Direction Finding

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.

- 16th January 2014, 21:41

- 19th January 2014, 13:08 #8

- Join Date
- Nov 2013
- Posts
- 14
- Helped
- 0 / 0
- Points
- 115
- Level
- 1

## Re: MUSIC Algorithm for Direction Finding

- 19th January 2014, 13:08

- 24th January 2014, 12:26 #9

- Join Date
- Nov 2013
- Posts
- 14
- Helped
- 0 / 0
- Points
- 115
- Level
- 1

- 23rd March 2014, 00:13 #10

- Join Date
- Nov 2013
- Posts
- 14
- Helped
- 0 / 0
- Points
- 115
- Level
- 1

## Re: MUSIC Algorithm for Direction Finding

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.

- 23rd March 2014, 01:14 #11

- Join Date
- Oct 2013
- Posts
- 162
- Helped
- 54 / 54
- Points
- 1,181
- Level
- 7
- Blog Entries
- 5

## Re: MUSIC Algorithm for Direction Finding

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.

1 members found this post helpful.

- 22nd January 2015, 09:38 #12

- Join Date
- Jan 2015
- Posts
- 2
- Helped
- 0 / 0
- Points
- 14
- Level
- 1

## Re: MUSIC Algorithm for Direction Finding

Weetabixharry i need your help in implementating MUSIC direction finding algorithm in matlab.

- 22nd January 2015, 23:00 #13

- Join Date
- Oct 2013
- Posts
- 162
- Helped
- 54 / 54
- Points
- 1,181
- Level
- 7
- Blog Entries
- 5

- 26th January 2015, 07:10 #14

- Join Date
- Jan 2015
- Posts
- 2
- Helped
- 0 / 0
- Points
- 14
- Level
- 1

- 27th January 2015, 19:35 #15

- Join Date
- Oct 2013
- Posts
- 162
- Helped
- 54 / 54
- Points
- 1,181
- Level
- 7
- Blog Entries
- 5

## Re: MUSIC Algorithm for Direction Finding

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.

1 members found this post helpful.

- 8th February 2015, 19:03 #16

- Join Date
- Feb 2015
- Posts
- 5
- Helped
- 0 / 0
- Points
- 30
- Level
- 1

## Re: MUSIC Algorithm for Direction Finding

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?

EnildoLast edited by FvM; 8th February 2015 at 19:42. Reason: Private email deleted

- 9th February 2015, 03:43 #17

- Join Date
- Feb 2012
- Posts
- 489
- Helped
- 35 / 35
- Points
- 2,659
- Level
- 12

## Re: MUSIC Algorithm for Direction Finding

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.

- 11th February 2015, 00:28 #18

- Join Date
- Oct 2013
- Posts
- 162
- Helped
- 54 / 54
- Points
- 1,181
- Level
- 7
- Blog Entries
- 5

## Re: MUSIC Algorithm for Direction Finding

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 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.

Sure, no problem.

2 members found this post helpful.

- 12th February 2015, 07:46 #19

- Join Date
- Feb 2015
- Posts
- 5
- Helped
- 0 / 0
- Points
- 30
- Level
- 1

## Re: MUSIC Algorithm for Direction Finding

Weetabixharry:

I want to estimate Azimuth and elevation.

Please, modify the code for me.

Thanks in advance.

ecosierra51

- 14th February 2015, 10:45 #20

- Join Date
- Oct 2013
- Posts
- 162
- Helped
- 54 / 54
- Points
- 1,181
- Level
- 7
- Blog Entries
- 5

## Re: MUSIC Algorithm for Direction Finding

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:

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 by weetabixharry; 14th February 2015 at 11:00.

2 members found this post helpful.