Part of it comes from online tutorials, if there is any infringement, please contact me to delete
Tutorial link: Intuitive explanation of MUSIC algorithm: 1. Background and basic knowledge of MUSIC algorithm_哔哩哔哩_bilibili
https://blog.csdn.net/zhangziju/article/details/100730081
1. Function of MUSIC algorithm
MUSIC (Multiple Signal Classification), multiple signal classification, is a type of spatial spectrum estimation algorithm. The idea is to use the covariance matrix (Rx) of the received data to perform eigendecomposition , separate the signal subspace and the noise subspace, use the orthogonality between the signal direction vector and the noise subspace to form a spatial scanning spectrum, and perform a global search for spectral peaks. , so as to realize the parameter estimation of the signal .
The MUSIC algorithm is commonly used for sound source localization using microphone arrays.
For example, when the microphone array is placed in a room, there is a sound source in the room. When the sound source is sounding, the array will receive the signal from the direction of the target, but will also receive the reflected signal from a different direction. The MUSIC algorithm can eliminate the remaining reflected signals, select the signal from the direction of the target, and obtain the direction of the target.
Sound waves are mechanical waves that are usually received by a microphone array and converted into electrical signals for processing. When the signal is an electromagnetic wave, such as a wifi signal, we use an antenna array to receive it. At this time, we can still use the MUSIC algorithm to calculate the angle of signals in different directions.
2. Principle of MUSIC algorithm
The MUSIC algorithm is suitable for incoming waves that are parallel waves, that is, the distance L between the target and the microphone array is much greater than the distance d between the array elements. At this time, the azimuth angle of the signal from the target relative to each array element can basically be regarded as the same. Specifically as shown in the figure below:
figure 1
1. Relationship between time delay, phase difference and target azimuth
Suppose the signal source transmits a signal as
When the signal propagates from the sound source target S to the array element 1, the signal travels a distance, assuming that the sound speed is c, it takes time
This will cause the phase of the received signal of array element 1 to be inconsistent with the transmitted signal , which will delay
Then the final received signal of array element 1 is:
Array element 2 has moved more than array element 1 , then the signal received by array element 2 is:
Among them , represents the phase difference between the received signal of array element 2 and the received signal of array element 1
Array element 3 has moved more than array element 1 , then the corresponding phase difference is:
Then the received signal of array element 3 is:
PS: If you still don’t understand how to calculate the phase difference caused by walking a longer distance, you can understand it like this (take array elements 1 and 2 as an example):
Suppose the received signal of array element 1 is
Because the signal arrives at array element 2 and travels a longer distance, the time for the signal to arrive at array element 2 will always be delayed compared to array element 1 (we usually call it time delay, in fact, the phase difference is caused by time delay)
Then the received signal of array element 2 is
Obviously, the phase difference of and is
It can be known from the knowledge of digital signal processing that the time delay of array element 1 and array element 2 in Figure 1
Then the phase difference can be obtained
2. The core principle of the MUSIC algorithm (source of ideas)
The ultimate goal of the MUSIC algorithm: calculation
It can be known from the above derivation that it is closely related to the phase difference of the received signals of the two array elements . If you can ask for it , you can ask for it .
Then under ideal conditions, that is, there is no reflection and refraction, and there is only one sound source. At this time, the phase difference can be obtained by directly dividing the received signals of the two array elements, and thus the target azimuth angle can be obtained .
But in fact, there will be many catadioptric signals received by the microphone array, and there may be more than one sound source. What should we do at this time? This is the problem that the MUSIC algorithm needs to solve.
Ok, then we assume that there are two sound sources A and B, and the transmitted signals are and (reflection and refraction are not considered for the time being)
Then at a certain time t, the received signals of the three array elements are:
Then within a certain period of time, the signal received by the microphone array is:
The correspondence can be written as:
Among them , what we know is what needs to be obtained, may be known, may not be known (when known and reversible, you can directly use the inverse matrix to find , but such cases are rare)
Can you eliminate the right side of the equation through processing ? (the core of the MUSIC algorithm)
How to deal with it? ? ?
If three complex numbers , and can be found, respectively perform amplitude and phase transformations on the received signals of the three array elements (multiplying a signal by a complex number means that the amplitude and phase transformations are performed on the signal), and the received signal after transformation There is a complete cancellation between the signals, namely:
or in matrix representation:
Substituting , and into the above formula respectively, we can get:
Right now:
The MUSIC algorithm makes an assumption at this time, that is, it is assumed that the signal and the signal are uncorrelated (assumption 1 of the MUSIC algorithm) (when the signal and the signal are linearly correlated, a non-zero complex number can be found such that )
Then the coefficients in the above formula must all be 0 at this time , that is:
The sum of the coefficients in the above formula can be eliminated directly, then it can be seen that the sum can be obtained as long as the sum and
So now the question is transformed into, how to find this set of complex numbers , and ? ? ?
To be able to find this set of complex numbers, it must be satisfied: the number of array elements > the number of sound source signals (Assumption 2 of the MUSIC algorithm)
In fact, the final solution is:
and
That is , the MUSIC algorithm finds the corresponding solution by finding the maximum value (spectral peak search) , which corresponds to the corresponding target azimuth .
3. Summary of MUSIC algorithm steps
The DOA mathematical model of the narrowband far-field signal is:
Among them, X is the signal matrix received by the array, and the two dimensions represent: the number of array elements and the number of sampling points (snapshots); A is the array direction matrix, and the two dimensions represent: the number of array elements, The direction vector of the signal direction; s is the signal source emission matrix, and the two dimensions respectively represent: the number of signal sources and the number of sampling points; N is the noise matrix, and the two dimensions are the number of array elements and the number of sampling points respectively.
Then the covariance matrix of the array receiving data is:
Since the signal and noise are independent of each other, the data covariance matrix can be decomposed into two parts related to the signal and noise, where Rs is the covariance matrix of the signal, and ARsA^H is the signal part.
The eigendecomposition of R is:
In the formula, Us is the subspace composed of the larger (number of signal sources) eigenvectors among all the eigenvalues of R, which is called the signal subspace; The subspace composed of eigenvectors is called the noise subspace.
According to the conditions of the MUSIC algorithm we derived before, ideally the signal subspace and the noise subspace are required to be orthogonal, that is, the direction vector a(theta) in the signal subspace is orthogonal to the noise subspace:
Due to the existence of noise, in fact a(theta) and Un are not completely orthogonal. So it's actually done by doing a minimal optimization search:
As we said above, MUSIC actually finds the optimal solution theta through peak search:
PS: Since the data accepted by the array is limited in practice, the covariance matrix is usually replaced by the maximum likelihood estimation of the covariance matrix:
Summarizing the above algorithm principles, the steps of the MUSIC algorithm are:
1. Obtain the estimated value of the following covariance matrix according to the N received signal vectors:
2. Perform eigendecomposition on the covariance matrix obtained in step 1
3. The matrix will have M eigenvalues. Arrange them from largest to smallest:
Among them, D (D=number of signal sources) larger eigenvalues correspond to signals, and the corresponding eigenvectors are regarded as part of the signal space.
MD (M=number of array elements) smaller eigenvalues correspond to noise, and the corresponding eigenvectors are regarded as part of the signal space, and the noise matrix is obtained
4. Make constant changes and calculate the spectral function:
An estimate of the direction of arrival is calculated by finding spectral peaks. Here is the direction corresponding vector of the array element.
,
4. Matlab code implementation
clear all
close all
clc
%----------------均匀线列阵实现MUSIC算法------------------%
ang2rad = pi/180; % 角度转弧度系数
N = 10; % 阵元个数
M = 3; % 信源个数
theta = [-65,0,45]; % 来波方向(角度)
snr = 10; % 信号信噪比dB
K = 512; % 总采样点
delta_d = 0.05; % 阵元间距
f = 2400; % 信号源频率
c = 340; % 声速
d = 0:delta_d:(N-1)*delta_d;
A = exp(-1i*2*pi*(f/c)*d.'*sin(theta*ang2rad)); % 接收信号方向向量
S = randn(M,K); % 阵列接收到来自声源的信号
X = A*S; % 最终接收信号,是带有方向向量的信号
X1 = awgn(X,snr,'measured'); % 在信号中添加高斯噪声
Rx = X1*X1'/K; % 协方差矩阵
[Ev,D] = eig(Rx); % 特征值分解
% [V,D] = eig(A) 返回特征值的对角矩阵 D 和矩阵 V
% 其列是对应的右特征向量,使得 AV = VD
EVA = diag(D)'; % 将特征值提取为1行
[EVA,I] = sort(EVA); % 对特征值排序,从小到大。其中I为index:1,2,...,10
EV = fliplr(Ev(:,I)); % 对应特征矢量排序
En = EV(:,M+1:N); % 取特征向量矩阵的第M+1到N列特征向量组成噪声子空间
% 遍历所有角度,计算空间谱
for i = 1:361
angle(i) = (i-181)/2; % 映射到-90度到90度
theta_m = angle(i)*ang2rad;
a = exp(-1i*2*pi*(f/c)*d*sin(theta_m)).';
p_music(i) = abs(1/(a'*En*En'*a));
end
p_max = max(p_music);
p_music = 10*log10(p_music/p_max); % 归一化处理
figure()
plot(angle,p_music,'b-')
grid on
xlabel('入射角/度')
ylabel('空间谱/dB')