📄 main.m
字号:
% function main()
clear all;
clf;
m=10;
p=8;
c=3e8;
N=2000;
f0=10e9;
d=(c/f0);
d=0.5*d;
s=zeros(p,N);
s_rec=zeros(m,N)
theta=linspace(-pi/3,pi/3,p);
f=linspace(1*f0,1*f0,p);
wi=zeros(1,p);
wi=2*pi*d*f0*sin(theta)/c
phi=linspace(0,pi/2,p);
s=to_get_s(f,phi,N,p,f0);
%===========================================================
% i=1:N;
% figure(1)
% subplot(4,1,1);
%plot(i,fft(s(1,:)));
% subplot(4,1,2);
% plot(i,fft(s(2,:)),'-r');
% subplot(4,1,3);
% plot(i,fft(s(3,:)));
% subplot(4,1,4);
% plot(i,fft(s(4,:)));
s_rec=get_s_rec(s,m,p,wi);
% % figure(2)
% subplot(2,1,2);
% plot(i,fft(s_rec(1,:)));
% % subplot(4,1,2);
% % plot(i,fft(s_rec(2,:)));
% % subplot(4,1,3);
% % plot(i,fft(s_rec(3,:)));
% % subplot(4,1,4);
% % plot(i,fft(s_rec(4,:)));
%===========================================================
Rxx=get_Rxx(s_rec,N,p,m);
j=sqrt(-1);
%==================================
P_w_f=zeros(1,10000);
w_f=linspace(-pi,pi,10000);
[Q,v]=eig(Rxx);
for i=1:(m-p)
for t=1:m
G(t,i)=Q(t,i);
end
end
for i=1:p
for t=1:m
S(t,i)=Q(t,i+m-p);
end
end
a=zeros(1,m);
%======================== TEST
%===================
for k=1:10000
for i=1:m
a(i)=exp(-j*w_f(k)*(i-1));
end
b=a;
b=b.';
P_w_f(k)=1/((b'*G*G'*b));
end
map_P=max(log10(P_w_f));
min_P=min(log10(P_w_f));
y_lab=linspace(min_P,map_P,10000);
figure(1)
clf
labda=c/f0;
% plot(w_f,log10(P_w_f));
plot(asin(labda.*w_f./(2*pi*d))*180/pi,log10(P_w_f));
theta_lab=zeros(p,10000);
for i=1:p
theta_lab(i,:)=linspace(theta(i),theta(i),10000);
end
hold on
for i=1:p
plot(theta_lab(i,:)*180/pi,y_lab,'r');
hold on;
end
grid on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -