Reply by Dilip Warrier October 2, 20082008-10-02
> --snippet-- > nse_vector = u(:,size(DOA,2):end); % eigen vectors spanning the noise > subspace >
Looks like you have a problem in this line. This should be: nse_vector = u(:,(size(DOA,2)+1):end); Your code seems to work fine with this change. Thanks, Dilip.
Reply by Rune Allnor September 20, 20082008-09-20
On 20 Sep, 04:08, "krish_dsp" <nmkr...@gmail.com> wrote:
> ok...i think the code I wrote will give you a better picture of what I am > trying to tell... > here is the code...one has to change the values in the array DOA between > -90 and + 90 to get a plot. When u increase the no of signals to more than > 2 the results are as I stated in my first mail. Also if u give values > between -80 to -90 or +80 to +90, u can see the errors in the final plot. > > here is the matlab code, i hope it clarifies what I am referring to.
No, it doesn't. You are complaining about errors that occur when you attempt to do something that has no chance in hell to produce 'correct' results. This might come as a surprise to you, but it is not sufficient that you (or somebody else) would like to compute or plot a result. There must be a sequence of causes and effects that takes you from whatever you start out from and end up where you want to be. I explained in a post a month ago why this chain of causes and effects break down - you throw away all the information that relates to peaks when you do the MUSIC computations. This is a very simple argument which is totally obvious when you sit down and actually review the equations you implement. Just two problems with that: - You have to sit down and review the equation - You have to understand what you see Rune
Reply by krish_dsp September 19, 20082008-09-19
ok...i think the code I wrote will give you a better picture of what I am
trying to tell...
here is the code...one has to change the values in the array DOA between
-90 and + 90 to get a plot. When u increase the no of signals to more than
2 the results are as I stated in my first mail. Also if u give values
between -80 to -90 or +80 to +90, u can see the errors in the final plot.

here is the matlab code, i hope it clarifies what I am referring to. 

close all;
clear all;
clc;
%--------------------------------------------------------------------------
d = 2; % lamda/d is the spacing between the sensors
SENSORS = 20; % NO OF SENSORS
% DIRECTION OF ARRIVALS IN DEGREES (NO OF DIRECTIONS CAN BE DECREASED OR
% INCREASED BY ADDING ANY ANGLE BETWEEN -90 AND +90 IN THE MATRIX DOA
DOA = [-20 40]; 
DOA = pi*DOA / 180;
snpshot = 100; % No of samples taken
%--------------------------------------------------------------------------
% A LxK MATRIX REPRESENTING THE 100 SNAP SHOTS OF THE SIGNAL INCIDENT ON
% THE FIRST SENSOR WHERE L IS THE NUMBER OF DIFFERENT SIGNALS AND K IS
THE
% NUMBER OF SNAP SHOTS (SIMULATED INPUT)
ang = 0
for l = 1:size(DOA,2)
    ang = ang + 0.23   
for k = 1:snpshot
    signal(l,k) = sin(2*pi*ang*k)*cos(2*pi*(ang+0.1)*k); %100 samples of
the signal
    end
end
%--------------------------------------------------------------------------
% A LxK MATRIX REPRESENTING THE STEERING VECTOR L REPRESENTS THE NUMBER
OF
% SENSORS AND K REPRESENTS THE NO OF ARRIVING SIGNALS
% CONSIDERING A SPACING OF LAMDA/2 BETWEEN THE SENSORS THE TIME
DIFFERENCE
% BETWEEN THE WAVES INCIDENT ON THE CONSECUTIVE SENSORS WITH A DOA OF
'THETA'
% IS CALCULATED AS LAMDA * SIN(THETA)/(2*c)
% THE STEERING VECTOR IS [EXP(-j*2*PI*F*TIMEDELAY)FROM 0 TO SENSORS-1]'
strvector(SENSORS, size(DOA,2)) = 0;
for k =1:size(DOA,2)
    for l = 1:SENSORS
        strvector(l,k) = exp(-j*pi*sin(DOA(k))*(l-1));
    end
end
%--------------------------------------------------------------------------

noise=0.3162/1.414*randn(SENSORS,snpshot); % RANDOM VARIABLE REPRESENTING
ADDED NOISE
ipsignal = (strvector * signal)+ noise; % X(t) = A(theta) * S(t) + n(t)
cov_signal = ipsignal * ipsignal'; % autocorrelation of the matrix
cov_signal = cov_signal/snpshot; %Normalization with the number of
samples
%--------------------------------------------------------------------------
%SINGULAR VALUE DECOMPOSITION FOR FINDING EIGEN VALUES AND VECTORS

[u,s,v] = svd(cov_signal);
nse_vector = u(:,size(DOA,2):end); % eigen vectors spanning the noise
subspace

%TESTING THE RESPONSE OF THE ALGORITHM BY PLOTTING A MUSIC SPECTRUM
% A BEAM SEARCH VECTOR WHICH IS SAME AS THE STEERING VECTOR ABOVE IS
% GENERATED FOR RANGE OF DIRECTIONS -90 DEG TO +90 DEG IS GENERATED WITH
% A RESOLUTION OF 0.25 DEG AND THE EIGEN VECTORS OF NOISE SUBSSPACE IS
% MULTIPLIED WITH THE BEAM SERCH VECTOR AND THE RECIPROCAL OF THE RESULT
% IS PLOTTED
angle=-90:0.25:90; %in degrees
angle2 = angle *pi/180; % in radians
for ctr=1:size(angle,2)
    beam_serch = exp(-j*pi*sin(angle2(ctr))*[0:SENSORS-1]);
    denom(ctr) = beam_serch * nse_vector * nse_vector'* beam_serch';
    mus_spec(ctr) = abs(1/(denom(ctr))); % MUSIC spectrum
end
figure;
plot(angle,mus_spec); % plotting function
%--------------------------------------------------------------------------

Reply by Rune Allnor September 19, 20082008-09-19
On 19 Sep, 21:15, "krish_dsp" <nmkr...@gmail.com> wrote:
> hi.. > i will talk about the eigen values first. When I read the theory of MUSIC > vectors, it was given that (in the form of expression) that out of the N > eigen values we get, first M (no of signals) eigen values will be equal to > the sum of the variance of noise and the eigen value of signals, then the > remaining (N-M) eigen values will be equal to the variance of the noise. So > all the N-M values should be equal isn't it. B'cos the auto correlation of > the noise results in (sigma)^2 * I(identity matrix).
That's the *expected* result in a perfect world. Once you actually implement something those idealized assumptions break down.
> If its not clear, I can share my program as a followup message. > may be I am not explaining the things well. As u said the MUSIC doesn't > compute any peaks. But for visual representation of the working of the > algorithm, i plotted the result.
So you say that 1) MUSIC produces no visually relevant result 2) You visualized the result anyway and ask why the visual plot doesn't make sense to you...? Rune
Reply by krish_dsp September 19, 20082008-09-19
hi..
i will talk about the eigen values first. When I read the theory of MUSIC
vectors, it was given that (in the form of expression) that out of the N
eigen values we get, first M (no of signals) eigen values will be equal to
the sum of the variance of noise and the eigen value of signals, then the
remaining (N-M) eigen values will be equal to the variance of the noise. So
all the N-M values should be equal isn't it. B'cos the auto correlation of
the noise results in (sigma)^2 * I(identity matrix).

If its not clear, I can share my program as a followup message.
may be I am not explaining the things well. As u said the MUSIC doesn't
compute any peaks. But for visual representation of the working of the
algorithm, i plotted the result.
for more clarification I can send the code.

The MUSIC algorithm is not good for coherent signals. What are the
algorithms that are good in DOA estimation for coherent signals.

bye.
>On 14 Sep, 06:54, "krish_dsp" <nmkr...@gmail.com> wrote: >> hi everyone, >> I have posted many queries regarding implementation of MUSIC algorithm
in
>> MATLAB. Now I have written a program that estimates the DOA using
music
>> algorithm. >> There are some queries and doubts about the results I got from the
output
>> which I would like to share. >> Let N be the no of sensors and M be the number of signals incident on
the
>> sensors. >> When I do the SVD of the auto correlation matrix, I am supposed to get >> (N-M) number of eigen values which are equal to the variance of noise >> vector. > >That happens only if the number of signals is indeed smaller >than the number of sensors. > >> I am getting very small values which is in concurrence with the >> theory but I am not getting the same values. > >Who said you would get the same values? > >> The noise eigen values are >> decreasing. Also the value of the first eigen value of the signal
subspace
>> is relatively very large than the rest of the eigen values of the
signal
>> subspace. > >Is there a reason why it shouldn't? > >> Is there an error in my program? > >I have no idea. What you have described so far is more or less >to be expected. > >> Also every time I execute the program, the peaks are varying
enormously
>> for the various DOA signals. sometimes some peaks in the plots are very
low
>> except the peak corresponding to the first eigen vector. > >Where did you get those peaks from? > >> I plotted the spectrum (doa spectrum) from -90 to +90 degrees. When i
try
>> to include a DOA nearer to the boundary (-80 to -90) and (+80 - +90),
they
>> are invariably damped. Can anyone explain the reason for this
behaviour?
> >MUSIC computes no peaks. Whatever it is you plot, it is random >data that are unrelated to anything useful in the signal. > >Rune > >
Reply by Rune Allnor September 19, 20082008-09-19
On 14 Sep, 06:54, "krish_dsp" <nmkr...@gmail.com> wrote:
> hi everyone, > I have posted many queries regarding implementation of MUSIC algorithm in > MATLAB. Now I have written a program that estimates the DOA using music > algorithm. > There are some queries and doubts about the results I got from the output > which I would like to share. > Let N be the no of sensors and M be the number of signals incident on the > sensors. > When I do the SVD of the auto correlation matrix, I am supposed to get > (N-M) number of eigen values which are equal to the variance of noise > vector.
That happens only if the number of signals is indeed smaller than the number of sensors.
> I am getting very small values which is in concurrence with the > theory but I am not getting the same values.
Who said you would get the same values?
> The noise eigen values are > decreasing. Also the value of the first eigen value of the signal subspace > is relatively very large than the rest of the eigen values of the signal > subspace.
Is there a reason why it shouldn't?
> Is there an error in my program?
I have no idea. What you have described so far is more or less to be expected.
> Also every time I execute the program, the peaks are varying enormously > for the various DOA signals. sometimes some peaks in the plots are very low > except the peak corresponding to the first eigen vector.
Where did you get those peaks from?
> I plotted the spectrum (doa spectrum) from -90 to +90 degrees. When i try > to include a DOA nearer to the boundary (-80 to -90) and (+80 - +90), they > are invariably damped. Can anyone explain the reason for this behaviour?
MUSIC computes no peaks. Whatever it is you plot, it is random data that are unrelated to anything useful in the signal. Rune
Reply by Dilip Warrier September 19, 20082008-09-19
On Sep 14, 12:54 am, "krish_dsp" <nmkr...@gmail.com> wrote:
> hi everyone, > I have posted many queries regarding implementation of MUSIC algorithm in > MATLAB. Now I have written a program that estimates the DOA using music > algorithm. > There are some queries and doubts about the results I got from the output > which I would like to share. > Let N be the no of sensors and M be the number of signals incident on the > sensors. > When I do the SVD of the auto correlation matrix, I am supposed to get > (N-M) number of eigen values which are equal to the variance of noise > vector. I am getting very small values which is in concurrence with the > theory but I am not getting the same values. The noise eigen values are > decreasing. Also the value of the first eigen value of the signal subspace > is relatively very large than the rest of the eigen values of the signal > subspace. > Is there an error in my program? > Also every time I execute the program, the peaks are varying enormously > for the various DOA signals. sometimes some peaks in the plots are very low > except the peak corresponding to the first eigen vector. > > I plotted the spectrum (doa spectrum) from -90 to +90 degrees. When i try > to include a DOA nearer to the boundary (-80 to -90) and (+80 - +90), they > are invariably damped. Can anyone explain the reason for this behaviour? > > Thank you.
It's hard to answer your questions without understanding what algorithm your code is implementing. Can you describe the formulae that you are implementing? Then, we should be able to help you. Thanks, Dilip.
Reply by krish_dsp September 14, 20082008-09-14
hi everyone,
I have posted many queries regarding implementation of MUSIC algorithm in
MATLAB. Now I have written a program that estimates the DOA using music
algorithm.
There are some queries and doubts about the results I got from the output
which I would like to share.
Let N be the no of sensors and M be the number of signals incident on the
sensors.
When I do the SVD of the auto correlation matrix, I am supposed to get
(N-M) number of eigen values which are equal to the variance of noise
vector. I am getting very small values which is in concurrence with the
theory but I am not getting the same values. The noise eigen values are
decreasing. Also the value of the first eigen value of the signal subspace
is relatively very large than the rest of the eigen values of the signal
subspace.
Is there an error in my program?
Also every time I execute the program, the peaks are varying enormously
for the various DOA signals. sometimes some peaks in the plots are very low
except the peak corresponding to the first eigen vector.

I plotted the spectrum (doa spectrum) from -90 to +90 degrees. When i try
to include a DOA nearer to the boundary (-80 to -90) and (+80 - +90), they
are invariably damped. Can anyone explain the reason for this behaviour?

Thank you.