How to create grating diffraction pattern.

How to create a code to plot the intensity of the light I see from the grating diffraction in theory.
The graph shows only the diffraction ranking at zero. I want the graph to show the first number diffraction.
Who can see if it might go wrong? Please help me.
x = linspace(-50, 50, 500);
A = 4*W;
lambda = 632.8e-9; % m
D = 1; % Distance to the observation plane m
W = 38e-6; % slit width(m)
fx = x/(lambda*D); % frequency coordinat
I = (A^2/(lambda^2*D^2)) .* sinc(2*W*fx).^2;
figure
plot(x, I)
grid
xlabel('fx')
ylabel('Intensity')

1 comentario

Star Strider
Star Strider el 2 de Mzo. de 2020
@Rose Mermate —
You quoted the code I posted in your other Question: How to create a code to plot the intensity of the light
That should do everything you want.
What part of my Answer do you need help to understand?

Iniciar sesión para comentar.

 Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 2 de Mzo. de 2020
Editada: KALYAN ACHARJYA el 30 de Dic. de 2024
x = linspace(-50, 50, 500);
lambda = 632.8e-9; % m
D = 1; % Distance to the observation plane m
W = 38e-6;
A = 4*W;% slit width(m)
fx = x/(lambda*D); % frequency coordinat
I = (A^2/(lambda^2*D^2)) .* sinc(2*W*fx).^2;
figure, plot(x,I)
grid
xlabel('fx')
ylabel('Intensity');
% Just repeat the same row multiple times
% For Better visualisation
grad_pattern=repelem(I,[50],[1]);
figure,imshow(grad_pattern,[]);
title('Diffraction Pattern');

8 comentarios

Rose Mermate
Rose Mermate el 2 de Mzo. de 2020
I want to have many peaks like in the picture.
KALYAN ACHARJYA
KALYAN ACHARJYA el 2 de Mzo. de 2020
What is m in the attched code?
Rose Mermate
Rose Mermate el 2 de Mzo. de 2020
m = diffraction order
KALYAN ACHARJYA
KALYAN ACHARJYA el 2 de Mzo. de 2020
No "m" in the code
Rose Mermate
Rose Mermate el 2 de Mzo. de 2020
Not in the equation
KALYAN ACHARJYA
KALYAN ACHARJYA el 2 de Mzo. de 2020
Editada: KALYAN ACHARJYA el 2 de Mzo. de 2020
Refer the book and incorporte "m" in the equation. If you explain the physics (Maths), so that we can help you to implement the same.
Prathamesh Chavan
Prathamesh Chavan el 12 de Mayo de 2021
M is a order of principal maxima..
OzjaszGoldberg
OzjaszGoldberg el 4 de Feb. de 2022
hi did you make it ?

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Etiquetas

Preguntada:

el 2 de Mzo. de 2020

Editada:

el 30 de Dic. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by