To calculate illuminace for four LEDs
12 ビュー (過去 30 日間)
古いコメントを表示
Hello,
This is the code to evaluate the illuminance using four LEDs. But the output graph iam getting only one LED output. Can anyone pls help me with the changes that i have to make in the code.
close all;
clear all;
%paper: Fundamental Analysis for Visible Light Communication Systems using
%LED lights
%Authors: Toshihiko Komine, Student
%Implemented by: Mrinmoyee Mukherjee
%This code is for four LEDs
%*****************************************
%This part defines the transmitter properties
%Semi angle at half power
hpa=60; %[in degrees]
%hpa defines the directivity of the source. Smaller the hpa, more is the
%directed power
%Centre luminous intensity
I0=0.73; %[defined in cadela]
%No. of LEDs in the box
N=60*60;
%******************************************
%Derived quantities of transmitter
%Total luminous intensity
I0_total=I0*60*60;
%mode number
%Note that log10 and log are different command sin matlab.
%The first one will give base 10 and second is natural log
%We use the second one
%a=log10(2);
m=-log(2)/log(cosd(hpa));
disp(m)
%Define room diamensions
lx=5; ly=5; lz=3; % room dimension in meter
%the distance between source and receiver plane
h=2.16170;
%No of grid in the receiver plane
Nx=lx*50; Ny=ly*50;% number of grid 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
%Define the position of LED
% position of LED1
XTrans1=-0.86; YTrans1=-0.86;
% position of LED2
XTrans2=-0.86; YTrans2=0.86;
% position of LED3
XTrans3=0.86; YTrans3=-0.86;
% position of LED4
XTrans4=0.86; YTrans4=0.86;
% distance vector from source 1
D1=sqrt((XR-XTrans1(1,1)).^2+(YR-YTrans1(1,1)).^2+h^2);
% distance vector from source 2
D2=sqrt((XR-XTrans2(1,1)).^2+(YR-YTrans2(1,1)).^2+h^2);
% distance vector from source 3
D3=sqrt((XR-XTrans3(1,1)).^2+(YR-YTrans3(1,1)).^2+h^2);
% distance vector from source 4
D4=sqrt((XR-XTrans4(1,1)).^2+(YR-YTrans4(1,1)).^2+h^2);
%Now we need to find the irradiation angles
coseno_phi1=h./D1;
coseno_phi2=h./D2;
coseno_phi3=h./D3;
coseno_phi4=h./D4;
%Now we can find the horizontal illuminance at points (lx,ly).
%Note that we are finding the illuminance hence the receiver position is
%not important
E_lux1=(I0_total*coseno_phi1.^m)./(D1.^2);
E_lux2=(I0_total*coseno_phi2.^m)./(D2.^2);
E_lux3=(I0_total*coseno_phi3.^m)./(D3.^2);
E_lux4=(I0_total*coseno_phi4.^m)./(D4.^2);
%Total illuminace at any point is the addition of all illuminace by all
%LEDs
E_lux=E_lux1+E_lux2+E_lux3+E_lux4;
meshc(x,y,E_lux);
xlabel('X (m)');
ylabel('Y (m)');
zlabel('Illuminance(lx)');
0 件のコメント
回答 (2 件)
Walter Roberson
2023 年 1 月 8 日
%Total illuminace at any point is the addition of all illuminace by all
%LEDs
E_lux=E_lux1+E_lux2+E_lux3+E_lux4;
You are totaling the four components and using meshc() on the total. You can use subplot() or tiledlayout to create multiple axes in which you meshc() each component by itself.
0 件のコメント
Image Analyst
2023 年 1 月 8 日
You're plotting only the sum of all 4. You need to plot each one (untested code because my MATLAB is busy right now)
subplot(2, 3, 1);
meshc(x,y,E_lux);
subplot(2, 3, 2);
meshc(x,y,E_lux1);
subplot(2, 3, 3);
meshc(x,y,E_lux2);
subplot(2, 3, 4);
meshc(x,y,E_lux3);
subplot(2, 3, 5);
meshc(x,y,E_lux4);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!