📄 laoshi2.m
字号:
Pd=2000;
Fd=1;
Fs=4*Fd;
R=0.5;
Delay=5;
M=4;
x1=randint(Pd,1,M);
x2=randint(Pd,1,M);
figure(1);
subplot(2,1,1);
plot(x1)
subplot(2,1,2);
plot(x1);
axis([0,200,0,3]);
figure(2);
subplot(2,1,1);
plot(x2)
subplot(2,1,2);
plot(x2);
axis([0,200,0,3]);
y1=modmap(x1,Fd,Fs,'qask',M);
y2=modmap(x2,Fd,Fs,'qask',M);
figure(3);
subplot(2,1,1);
plot(y1);
axis([0,200,-3,3]);
%axis([0,200,0,4]);
subplot(2,1,2);
plot(y2);
axis([0,200,-3,3]);
%axis([0,200,0,4]);
[rcv_a1,ti]=rcosflt(y1,Fd,Fs,'fir/sqrt/Fs',R,Delay);
[rcv_a2,ti]=rcosflt(y2,Fd,Fs,'fir/sqrt/Fs',R,Delay);
figure(4);
subplot(2,1,1);
plot(rcv_a1);
axis([0,200,-3,3]);
%axis([0,200,0,6]);
subplot(2,1,2);
plot(rcv_a2);
axis([0,200,-3,3]);
%axis([0,200,0,6]);
s1=amodce(rcv_a1,10,'qam');
% s2=amodce(rcv_a2,10,'qam');
s2=s1; %????s1?s2??
save sig3 s1 s2
figure(5);
subplot(2,1,1);
plot(s1);
%axis([-3,3,-3,3]);
subplot(2,1,2);
plot(s2);
%axis([-3,3,-3,3]);
clear
m=8; %???
angle1=-10;
angle2=10;
th=[angle1;angle2];
nn=1024;
SN1=10;
SN2=10;
SN3=12;
sn=[SN1;SN2];
degrad=pi/180;
load sig3
tt=1:nn;
S=[s1(tt).';s2(tt).'];
nr=randn(m,nn);
ni=randn(m,nn);
U=nr+j*ni; %???????2.
Ps=S*S'/nn;
ps=diag(Ps);
refp=2*10.^(sn/10);
tmp=sqrt(refp./ps);
S2=diag(tmp)*S;
tmp2=[0:m-1]'; %????
A=exp(-i*pi*tmp2*sin(th'*degrad)); %????
X=A*S2+U;
Rxx=X*X'/nn;
Rinv=inv(Rxx);
rxd=X*S2(1,:)'/nn;
w_lms=Rinv*rxd;
y=w_lms'*X;
figure
plot(tt,y);
axis([0 100 -6 6])
% for n=1:1024
%e(n)=S2(n)-y(n);
%u(n)=(1./(1+exp(-abs(e(n)))))-0.5;
%w_lms=w_lms+2*u(n)*conj(e(n))*X(n);
%end
k=[-90:90]';
tmp=-i*pi*sin(k'*degrad);
tmp2=[0:m-1]';
a2=tmp2*tmp;
Ap=exp(a2);
pattern2=abs(w_lms'*Ap).^2/2;
pdb2=10*log10(pattern2);
figure(10)
plot(k,pdb2);
%axis([-90 180 -30 180]);
xlabel('Angle[degree]');
ylabel ('Antenna Pattern');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -