亲爱的。我正在尝试实现Matlab的室内可见光通信系统来计算光接收功率。我成功地根据以下公式对源 LED 和接收器 PD 之间的功率进行了视线计算,
即以下行代码:
H_A1 = (m+1)*Adet.*cosphi_A1.^(m+1)./(2*pi.*D1.^2); % Channel DC gain for source
如上图所示,有cos(phi)和cos(psi),Tf & Gc将被忽略。在以下代码中,由于视线规则,cos(phi) 和 cos(psi) 被忽略并被视为 1。
我在这里尝试做的是我想在上面的代码行中考虑 cos(phi) 和 cos(psi) 假设 psi = 0 and phi = 0:5:30。
我想根据上图在下一行添加 cos(phi) 和 cos(psi)
H_A1 = (m+1)*Adet.*cosphi_A1.^(m+1)./(2*pi.*D1.^2); % Channel DC gain for source
并以增加步长 5 的方式将 phi=0, psi= 0 赋予 30。
在 psi 的每个新值中,我想计算 H_A1 以计算接收功率 P_rec。
请问有什么帮助吗?
Matlab代码:
close all;
clear all;
clc;
%% LED/PD Parameters
theta = 70; % Semi-angle at half power
m = -log10(2)/log10(cosd(theta)); % Lambertian order of emission
P_total = 20; % Transmitted optical power by individual LED
Adet = 1e-4; % Detector physical area of a PD
%% Optical elements parameters
Ts = 1; % Gain of an optical filter; ignore if no filter is used
index = 1.5; % Refractive index of a lens at a PD; ignore if no lens is used
FOV = 60*pi/180; % FOV of a receiver
G_Con = (index^2)/sin(FOV); % Gain of an optical concentrator; ignore if no lens is used
%% Room parameters
lx = 5; ly = 5; lz = 3; % Room dimensions in meter
h = 2.15; % The distance between the source and receiver plane
%% Mesh setup
% 2 dimensional setup
XT = 0; YT = 0; % The Position of the LED
Nx = lx*10; Ny = ly*10; % Number of grids in the receiver plane
x = -lx/2 : lx/Nx : lx/2;
y = -ly/2 : ly/Ny : ly/2;
[XR, YR] = meshgrid(x,y); % Receiver plane grid
%% Computation based on LOS channel equations
D1 = sqrt((XR-XT(1,1)).^2 + (YR-YT(1,1)).^2 + h^2); % Distance vector from source
cosphi_A1 = h./D1; % Angle vector
H_A1 = (m+1)*Adet.*cosphi_A1.^(m+1)./(2*pi.*D1.^2); % Channel DC gain for source
P_rec = P_total.*H_A1.*Ts.*G_Con; % Received power from source
P_rec_dB = 10*log10(P_rec);
%% Plotting
meshc(x,y,P_rec_dBm);
colorbar
xlabel('X (m)');
ylabel('Y (m)');
zlabel('Received power (dBm)');
axis([-lx/2 lx/2 -ly/2 ly/2 min(min(P_rec_dBm)) max(max(P_rec_dBm))]);
您可以将 phi 定义为向量,但由于维度不匹配,绘图网格会出现问题 事实上,对于每个角度,都会有一个“唯一的图形”,并且我们无法为向量中给定的所有角度值绘制图形。 Psi 也受此影响。 我们可能将接收到的功率作为向量,因为 cos 在公式中将是一个向量,但不可能绘制该向量的网格,每个接收到的功率值都有一个唯一的网格图。