📄 my.m
字号:
%The building selected is of 20 floors and 100m long.Every 5m there is a
%partition.Each floor is 5m high.Certainly between two floors there is a
%wall.
%The wall and the partition are the obstacles that make signal has path
%loss.We suppose all the path loss is made by the obstacles referred above.
%The path loss is the same as "914 MHz Path Loss Prediction Models for
%Indoor Wireless Communications in Multifloored Buildings".The path loss of
%this model is accorded with the formula described below.
%The transceiver is "single-chip radio transceiver for the 433/868/915 MHz
%ISM band" whose Typical Sensitivity is -100dBm and Maximum transmit output
%power is 10dBm.
%We simulink the system to check if we can commmunicate wirelessly between
%any two sites.What's more, we can plot the curve of the path loss varying
%with the distance d.
%The fomular is PL(d)[dB]=20.0*log10(4*pi*d/ranta)+p*AF(soft partition)[dB]
%+q*AF(concrete wall)[dB]
%把整栋楼看成一个二维平面,收发端看成是坐标系里有x轴y轴坐标值来描述的点,依此仿真
%这两点间能否进行通信
function f=my(x0,y0,x1,y1)
Pmax=-20;%Maximum transmit output power is 10dBm,that is -20dB
Pmin=-130;%Typical Sensitivity is -100dBm,that is -130dB
ranta=0.328;%电磁波长ranta=3*10^8/(914*10^6)=0.328
AF1=1.39;%the soft partition Attenuation Factor is 1.39dB
AF2=2.38;%the concrete wall Attenuation Factor is 2.38dB
d1=abs(y1-y0);%收发之间的垂直距离。依实际,y的值都是5的倍数
d2=abs(x1-x0);%收发之间的水平距离
d=sqrt(d1^2+d2^2);%收发端的距离
p=floor(d2/5);%收发之间的软隔墙数
q=d1/5;%收发之间的混凝土墙数
PL=20.0*log10(4*pi*d/ranta)+p*AF1+q*AF2;%收发之间的路径损耗
Pr=Pmax-PL;%收端的功率
%检测收发端能否进行通信
if Pr>=-130
f=1;%代表能通信
else
f=0;%代表不能通信
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -