I don't know what's wrong in this code, it doen't produce a graph.

1 visualización (últimos 30 días)
clear
clc
y = -4:0.01:4;%distance to fringes on the screen
Lembda=input('Enter your wavelength ')
Lambda = Lembda*1e-9; % Wavelength in m
a=input('enter the single slit width ')
a = a*1e-3; % Units to m
d=input('enter the slit width')
d = d*1e-3; % Units to m
L = 5*d;
for i = 1:length(y)
theta(i) = atan(y(i)/100/L); % Unit conversion of y to m %From the figure
alpha(i) = pi.*a.*sin(theta(i))./Lambda;
beta(i) = pi.*d.*sin(theta(i))./Lambda;
IR = (cos(beta(i)).^2).*(sin(alpha(i))./alpha(i)).^2;
end
plot(y,IR)
xlabel('y (in cm)')
ylabel('I/Imax')
title('Intensity Ratio Plot')
grid on

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 7 de Nov. de 2019
Editada: KALYAN ACHARJYA el 7 de Nov. de 2019
IR(i)= (cos(beta(i)).^2).*(sin(alpha(i))./alpha(i)).^2;
%..^ here inside for loop

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by