我试图用Friis的自由空间方程绘制TX / RX与接收信号强度之间的分离距离效应图。
我遇到图表问题。当我的pr在dbm单元中时,该值不正确。
我的代码如下:
clc;
close all;
clear all;
d = 1:0.1:20 ;
f = 2100000000;
Wavelength = (3*10^8/f).^2;
PT = 50.12;
PR = (Wavelength./(4*pi*d).^2)*PT ;
PR1 = 10*log(PR/(10*10.^-3)) ;
subplot(2,1,1);
plot(d,PR);
xlabel('x--> D (distance in Km)');
ylabel('y--> PR (Received power in Watts)');
title('Distance of separation between the TX/RX and the receive signal strength');
grid on
subplot(2,1,2);
plot(d,PR1);
xlabel('x--> D (distance in Meter)');
ylabel('y--> PR (Received power in dBm)');
title('Distance of separation between the TX/RX and the receive signal strength');
grid on;
答案 0 :(得分:0)
我不是关于计算主题的专家,但似乎你的第二个子图包含两个错误:一个尺度误差(X轴应该使用米作为基本单位而不是千米)和转换错误(从瓦特到dBm的转换应以不同方式计算)。
第一个问题很容易解决。为了获得以千米为单位的距离,从公里开始,只需这样做:
df <-
structure(
list(
id = c(1L, 1L, 1L, 1L, 2L, 3L, 3L, 3L, 4L, 4L, 4L),
time1 = c(12L, 5L, 3L, 23, 22L, 17L, 5L, 25L, 5L, 15L, 24L),
status=c(1L,1L,1L,0L,0L,1L,1L,0L,1L,1L,0L)
),
.Names = c("id", "time1","status"),
class = "data.frame",
row.names = c(NA,-11L)
)
现在,关于第二个问题,我认为你应该按照以下步骤进行:
function updateForm(){
var form = FormApp.openById("FormID");
var namesList = form.getItemById("ItemID").asListItem();
var ss = SpreadsheetApp.getActive();
var names = ss.getSheetByName("SourceSheetName");
var namesValues = names.getRange(2, 1, names.getMaxRows() - 1).getValues();
var List = [];
for(var i = 0; i < namesValues.length; i++)
if(namesValues[i][0] != "")
List[i] = namesValues[i][0];
namesList.setChoiceValues(List);
}
因此:
d1 = d .* 1000;
以下是最终代码:
dBW = 10 * log10(PR)
dBm = 10 * log10(1000 * PR)
= 10 * log10(PR) + 10 * log10(1000)
= 10 * log10(PR) + 10 * 3
= 10 * log10(PR) + 30
= dBW + 30