# How to implement the math equation correctly to make a plot ?

2 views (last 30 days)
Vahram Voskerchyan on 22 Jun 2021
Answered: Walter Roberson on 22 Jun 2021
I have a equation for irradiance distribution that says.
it's an radiance distribution where the k is the wave vector , Λ is the period between the emitting elements. Implementing the equaiton can give the plot showing below. I am struggling to implement this equation when I plug everything in all I get is a single value. How do I loop this equation and create a matrix so it can give me the plot that is shown below ?
%rectangular aperture array factor.
I_0 = 1;
lambda =1.55e-6;
k=(2*pi)/lambda;
period = 2e-6;
theta = 20;
numel=33;
I = I_0*abs(((sind(k*period*sind(theta))/k*period*sind(theta))*(sind(numel/2*k*sind(theta))/sind(0.5*k*period*sind(theta)))))
For now I am trying to implement the equation to have the plot like below. But this will only give a signle value. How can I implement the right equation to have the plot shown above.
##### 2 CommentsShowHide 1 older comment
KSSV on 22 Jun 2021

Walter Roberson on 22 Jun 2021
%rectangular aperture array factor.
N = 150;
I_0 = 1;
lambda =1.55e-6;
k=(2*pi)/lambda;
period = 2e-6;
theta = linspace(-25,25,N);
numel=33;
I = I_0 .* abs(((sind(k .* period .* sind(theta)) ./ k .* period .* sind(theta)) .* (sind(numel ./ 2 .* k .* sind(theta)) ./ sind(0.5 .* k .* period .* sind(theta)))));
plot(theta, I)
As you increase N, you will get a denser and denser plot that is more and more unreadable. That is because you are plotting a high frequency signal.

### Categories

Find more on Lighting, Transparency, and Shading in Help Center and File Exchange

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by