相位phei = 2*pi*f*d*sind(theta),因此理论上来讲测向的算法都可以用来测频。
ESPRIT:Estimating signal parameters viarotational invariance techniques,中文为旋转因子不变法。
ESPRIT用于测频:
%Example_esprit
clear all;clc;close all;
N=200; %signal length
m = N/2;
L=N-m;
s_amp=[1.31*exp(1i*pi/4),2.07*exp(1i*pi/3),1.88*exp(1i*pi/5)];
s_omega=[0.12*pi,0.37*pi,0.72*pi];
eps_sigma=0;
sigma=0.5;
x=zeros(1,N);%initialize
w = sqrt(sigma)*randn(1,N);
n = [1:N];
for slen=1:length(s_omega)
x = x+s_amp(slen)*exp(1j*s_omega(slen)*n) ;
end
x=x+w;
for n = 1:L
X(:,n) = x(n:(n+m-1));
end
for n = 1:L
Y(:,n) = x((n+1):(n+m));
end
%Rxx\Rxy
Rxx = 0;
for i = 1:L
Rxx = Rxx+X(:,i)*X(:,i)';
end
Rxx = Rxx/L;
Rxy = 0;
for i = 1:L
Rxy = Rxy+X(:,i)*Y(:,i)';
end
Rxy = Rxy/L;
[A,B] = eig(Rxx);
var = min(diag(B));
I = eye(m);
Z = diag(ones(1,m-1),-1);
Cxx = Rxx - I*var;
Cxy = Rxy - Z*var;
[~,B] = eig(Cxx,Cxy);
f=angle(diag(B));
[~,fpos]=sort(abs(abs(diag(B))-1));
f=f(fpos);
fval=f(f>0);
omega_est=sort(fval(1:length(s_amp)));
disp('结果对比:')
[omega_est,s_omega']
ESPRIT用于测向:
clear all
clf
set(0,'defaultaxesfontsize',22);
M=12;
Nb=32;
P=3;
%angles=[25 80 135]*(pi/180);
angdeg=[80 90 115];
angles=angdeg*(pi/180);
dlambda=0.5;
%generate random bits of information
poles=zeros(1,P);
X=zeros(M,Nb);
Rideal=zeros(M,M);
for k=1:P,
mu=pi*cos(angles(1,k));
poles(1,k)=exp(j*mu);
a=exp(j*mu*(0:M-1)).';
Rideal=Rideal+a*a';
br=ones(1,Nb);
temp=rand(1,Nb);
br(find(temp<.5))=-1;
bi=ones(1,Nb);
temp=rand(1,Nb);
bi(find(temp<.5))=-1;
b=br+j*bi;
X=X+a*b;
end
%add some noise
X=X+0.6*(randn(M,Nb)+j*randn(M,Nb));
Rxx=X*X'/Nb;
[E,D,V]=svd(Rxx);
%ESPRIT algorithm:
Es=E(:,1:P);
Es1=Es(1:M-1,:); Es2=Es(2:M,:);
Psi=Es1\Es2;
[T,Phi]=eig(Psi);
Phivec=diag(Phi);
%plot eigenvalues from ESPRIT and compare with true frequencies
polar(0,1,'.')
hold on
plot(real(poles),imag(poles),'kx','MarkerSize',12,'Linewidth',2);
plot(real(Phivec),imag(Phivec),'ro','MarkerSize',12,'Linewidth',2);
hold off
legend('True "poles"','ESPRIT eigenvalues')