⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 synnpath061024.m

📁 前向链路的信道路径仿真 为通信事业做出点小小事情
💻 M
字号:
function main()
N=50;              %栅格数
V=5;
axis([0,1,0,1])
axis on
XX=[1/N:1/N:1];
YY=[1/N:1/N:1];
HandleStart=line([0.2 0.2],[0.2 0.2]);
HandleTarget=line([0.8 0.8],[0.8 0.8]);
set(HandleStart,'marker','pentagram','color',[0 0 0])
set(HandleTarget,'marker','*','color','r')
%Set the position of the Obstacle
for i=20:25
    for j=20:30
         HandleO=line([XX(i) XX(i)],[YY(j) YY(j)]);
        set(HandleO,'marker','square','markerfacecolor',[0 0 0],'markersize',1,'markeredgecolor',[0 0 0])
    end
end
WS=zeros(N,N);
II=zeros(N,N);
for i=1:100
II=CacuII(WS,N,V);
WS=CacuWS(WS,N,II);
if(WS(10,10)>0)    break
    end
end
i=10;
j=10;
for t=1:100
    
    %II=CacuII(WS,N,V);
   % WS=CacuWS(WS,N,II);
    if((WS(i+1,j+1)>WS(i+1,j))&(WS(i+1,j+1)>WS(i,j+1)))    j=j+1; i=i+1;
    elseif ((WS(i,j+1)>WS(i+1,j+1))&(WS(i,j+1)>WS(i+1,j)))    j=j+1;
    else    i=i+1;
    end
    pause(0.2)
    HandleRobot=line([i/N,i/N],[j/N j/N]);
    set(HandleRobot,'marker','o','color','g')
    if(WS(i,j)==1) break
    end
 x=t
end
function II=CacuII(WS,N,V)
for i=1:N
    for j=1:N
        if ((i>20)&(i<25)&(j>20)&(j<30))    II(i,j)=-V;
        elseif ((i==1)|(i==N)|(j==1)|(j==N))     II(i,j)=-V;
        elseif ((i==40)&(j==40))    II(i,j)=V
        end
    end
end
function WS=CacuWS(WS,N,II)
Tij=exp(-0.9);
a=0.5;        %斜率
for i=2:N-1
    for j=2:N-1
        u=Tij*(WS(i-1,j)+WS(i,j+1)+WS(i+1,j)+WS(i,j-1));
        u=u+II(i,j);
        if (u<=0)   WS(i,j)=0;
        elseif (u>=1)   WS(i,j)=1;
        else    WS(i,j)=a*u;
        end
    end
end

           
            

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -