📄 uwb.m
字号:
t=0.001e-8:1/512e8:2e-8;
d=0:0.4e-8:2e-8;
y=pulstran(t,d,'rectpuls',0.2e-8);
%subplot(4,1,1)
%plot(t,y);
j=sqrt(-1);
w0=8e9;
w1=4e9;
%y1=exp(-j*w0*t);
%subplot(4,1,2)
%plot(t,y1);
Y=pulstran(t,d,'rectpuls',0.2e-8).*exp(-j*w0*t);
Y1=pulstran(t,d,'rectpuls',0.2e-8).*exp(-j*w1*t);
Y2=pulstran(t+0.2e-8,d,'rectpuls',0.2e-8).*exp(-j*w0*t);
Y3=pulstran(t+0.2e-8,d,'rectpuls',0.2e-8).*exp(-j*w0*t);
%subplot(2,1,1)
%plot(t,Y);
%subplot(2,1,2)
%plot(t,Y2);
%MUSIC算法
m=3; %天线阵元数
p=2;
angle1=30;
angle2=60;
th=[angle1;angle2];
lma=2; % 入射信号波长
d=lma/2; %阵元间距
nn=1024; %采样数
SN1=3; %信号信噪比
SN2=3;
sn=[SN1;SN2];
degrad=pi/180;
%构造噪声源
M=4; %码元为四进制
nr=randn(m,nn);
ni=randn(m,nn);
U=nr+j*ni; %构造噪声源
%加高斯信道
YY=awgn(Y,1);
YY1=awgn(Y1,1);
Y22=awgn(Y2,1);
Y33=awgn(Y3,1);
%加瑞利衰落信道
c=rayleighchan(1/4e9,1000);
YY2=filter(c,YY);
YY3=filter(c,YY1);
Y222=filter(c,Y22);
Y333=filter(c,Y33);
YY22=YY2+0.5*Y222;
YY33=YY3+0.5*Y333;
plot(t,YY22);
S=[YY22;YY33];
Ps=S*S'/nn;
ps=diag(Ps); %输入信号功率
%sn=20*ones(length(ps),1);
refp=2*10.^(sn/10); %参考信号功率
tmp=sqrt(refp./ps);
S2=diag(tmp)*S;
%%计算协方差矩阵并进行特征值分解%%
tmp=-i*2*pi*d*sin(th'*degrad)/lma;
tmp2=[0:m-1]';
a2=tmp2*tmp;
A=exp(a2); %阵因子
X=A*S2+U; %阵列接受信号
Rxx=X*X'/nn; %接受信号协方差
[s1,h1]=eig(Rxx);
Vn=s1(:,1:m-p);
%C=inv(Rxx);
%%求空间谱函数%%
th2=[-90:1:90];
for nnn=1:length(th2)
tmp=-i*2*pi*d*sin(th2(nnn)*degrad)/lma;
tmp2=[0:m-1]';
a2=tmp2*tmp;
A2=exp(a2);
num=A2'*A2; % 分子
Ena=A2'*Vn;
den=Ena*Ena'; %分母
doa(nnn)=num./den;
end
%%做出谱图%%
semilogy(th2,doa);
axis([-90 90 0.1 1e8]);
hold on;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -