前向传输: 正向传出30dBm,传到-10dBm时停止,坐标为(3m,-10dBm) Signal Modulation:(3m,-15dBm)
导入包
import matplotlib.pyplot as plt import numpy as np import math #设置大小 plt.figure(figsize=(10, 7), dpi=100) # 绘制颜色为蓝色、宽度为 1, 像素的连续曲线 y plt.plot(x, y, color="blue", linewidth=1.0, linestyle="-", label="Forward") # 绘制颜色为紫色、宽度为 1, 像素的不连续曲线 Y plt.plot(X, Y, color="#800080", linewidth=1.0, linestyle="--", label="Backward") plt.legend(loc="upper left") #后向曲线 x = x=np.linspace(-32,3,50) node = (3 - x) ** 2 P_rx = 0.7 / node y1 = 10 * np.log10(P_rx) y = y1 - 45 plt.plot(x, y) # 设置横轴精准刻度 plt.xticks([-32, -16, -8, -4, -2, -1, 0, 1, 2, 4, 8]) # 设置纵轴精准刻度 plt.yticks([-90, -80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40]) plt.tight_layout() #标注 plt.scatter([2], [-46.5], s=50, color="#800080") plt.annotate("(2, -46.5)", xy=(2, -46.5), fontsize=12, xycoords='data') plt.scatter([0], [-56], s=50, color="#800080") plt.annotate("(0, -56)", xy=(0, -56), fontsize=12, xycoords='data') plt.scatter([-10], [-68.8], s=50, color="#800080") plt.annotate("(-10, -68.8)", xy=(-10, -68.8), fontsize=12, xycoords='data') plt.scatter([-15], [-71.7], s=50, color="#800080") plt.annotate("(-15, -71.7)", xy=(-15, -71.7), fontsize=12, xycoords='data') plt.scatter([-20], [-73.9], s=50, color="#800080") plt.annotate("(-20, -73.9)", xy=(-20, -73.9), fontsize=12, xycoords='data') plt.scatter([-25], [-75.5], s=50, color="#800080") plt.annotate("(-25, -75.5)", xy=(-25, -75.5), fontsize=12, xycoords='data') #前向曲线 X=np.linspace(0,3,30) Y = 10 * np.log10(0.7 / X ** 2) plt.plot(X, Y) #描点 plt.scatter([3], [-10], s=50, color="#800080") plt.annotate("(3, -10)", xy=(3, -10), fontsize=12, xycoords='data') plt.scatter([1], [-1.5], s=50, color="#800080") plt.annotate("(1, -1.5)", xy=(1, -1.5), fontsize=12, xycoords='data')画图结果: