dears. I am trying to implement Matlab's indoor visible light communication system to calculate the optical received power. And I successfully made a line of sight calculation for the power between the source LED and the receiver PD based on the following formula,
That is in the following line code:
H_A1 = (m+1)*Adet.*cosphi_A1.^(m+1)./(2*pi.*D1.^2); % Channel DC gain for source
As shown in the above picture, there is cos(phi) and cos(psi), Tf & Gc will be ignored. In the following code, cos(phi) and cos(psi) are ignored and considered 1 due to line of sight rules.
What I am trying here to do is I want to consider cos(phi) and cos(psi) in the above line of code by assuming psi = 0 and phi = 0:5:30.
I want to add cos(phi) and cos(psi) in the following line based on the above picture
H_A1 = (m+1)*Adet.*cosphi_A1.^(m+1)./(2*pi.*D1.^2); % Channel DC gain for source
And give phi=0, psi= 0 to 30 with increasing step 5.
In every new value to psi, I want to calculate H_A1 in order to calculate the received power P_rec.
Any assistance, please?
Matlab code:
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))]);
