rayleigh1.asv
来自「无线通信系统中的空时编码的仿真程序。多天线发送」· ASV 代码 · 共 33 行
ASV
33 行
function b=rayleigh1
clear all;
clf;
a=10; % uniform distribution between 0 and a
N=4;
trange=1;
T=unifrnd(0,a,2,N);% there are totally N transmission nodes in the network
plot(T(1,:),T(2,:),'r*','MarkerSize',10);
axi
R=ones(2,N);
c=ones(2,N);
incide=zeros(1,N);
i=1;
while i<N+1
c1=unifrnd(0,a,2,1);
c(1,:)=c1(1,1);
c(2,:)=c1(2,1);
incidefind=find(incide);
for j=1:1:length(incidefind)
c(1,incide(1,j))=100;
c(2,incide(1,j))=100;
end
abst=((T(1,:)-c(1,:)).^2+(T(2,:)-c(2,:)).^2).^0.5;
[minvalue,incide1]=min(abst);
if minvalue<trange
R(1,i)=c1(1,1);
R(2,i)=c1(2,1);
incide(1,i)=incide1;
i=i+1;
end %the receiving node is in the transmission range
end %there are totally N receiving nodes
hold on;
plot(R(1,:),R(2,:),'b*','MarkerSize',10);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?