How to create grating diffraction pattern.
38 views (last 30 days)
Show older comments
Rose Mermate
on 2 Mar 2020
Edited: KALYAN ACHARJYA
on 30 Dec 2024 at 16:12
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 Comment
Star Strider
on 2 Mar 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?
Accepted Answer
KALYAN ACHARJYA
on 2 Mar 2020
Edited: KALYAN ACHARJYA
on 30 Dec 2024 at 16:12
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 Comments
More Answers (0)
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!