%用music算法估计散射点的位置幅度信息
function [r_final,rm_num]=music(data)
k=25;
deltaf=2e7;
c=3e8;
y=data;%取一维距离像
N=size(y,1);
R=zeros(k,k);
for n=1:N-k
R=R+y(n:n+k-1)*(y(n:n+k-1))';
end
R=R/(N-k+1);
[V,D]=eig(R);
nabna=diag(D);
theta=4e-7;
for m=1:size(nabna)
if nabna(m) M=m;
end
end
G=V(:,M:size(V,2));%k-M个特征值
r=[-5:0.001:5];
r_num=size(r,2);
P=zeros(r_num,1);
for h=1:r_num
q=exp(-j*2*pi*r(h)*deltaf/c);
A=zeros(1,k);
AU=0;
for i=1:k
Q=q^(i-1);
A(i)=Q;
end
a=1/sqrt(k)*A;
for i=1:k-M
AU=AU+abs(a*G(:,i))^2;
end
P(h)=abs(1/(1-AU));
end
%r=r/5;
% plot(r,P)%画出MUSIC谱
rm=zeros(1,20);%散射中心位置矩阵
ii=1;
for i=2:r_num-1
if P(i)>P(i+1)&&P(i)>P(i-1)
rm(ii)=r(i);
ii=ii+1;
end
end
r_final=rm(1:ii-1);
rm_num=size(r_final,2)