MATLAB plotting
Here is the problem:
When monochromatic light passes through a
narrow slit it produces on a screen a diffraction
pattern consisting of bright and dark fringes.
The intensity of the bright fringes, I, as a function
of can be calculated by
I = Imax (sinα/α)^2, where (α=πa/λ)sin(theta)
where delta is the light wave length and a is the
width of the slit. Plot the relative intensity
as a function of for –20° ≤ θ ≤ 20°. Make one plot that contains three
graphs for the cases a = 10λ, a = 5λ and a = λ Label the axes, and display
a legend.
OK, that being said.... I have this so far written on my script:
theta = [-20: 0.01: 20];
I = sin(10*pi*sin(theta)/(10*pi*sin(theta)))^2;
I2 = sin(5*pi*sin(theta)/(5*pi*sin(theta)))^2;
I3 = sin(pi*sin(theta)/(pi*sin(theta)))^2;
plot (theta,I)
hold on
plot (theta,I2)
plot (theta,I3)
xlim([-20 20]);
ylim([.5 1]);
legend('I, I2, I3')
xlabel ('x-axis')
ylabel ('y-axis')
hold off
It seems to just give me a straight line... I'm pretty sure I did the math right. Does anyone know where I went wrong?? It seems simple enough, but it's giving a hell of a lot of trouble.
When monochromatic light passes through a
narrow slit it produces on a screen a diffraction
pattern consisting of bright and dark fringes.
The intensity of the bright fringes, I, as a function
of can be calculated by
I = Imax (sinα/α)^2, where (α=πa/λ)sin(theta)
where delta is the light wave length and a is the
width of the slit. Plot the relative intensity
as a function of for –20° ≤ θ ≤ 20°. Make one plot that contains three
graphs for the cases a = 10λ, a = 5λ and a = λ Label the axes, and display
a legend.
OK, that being said.... I have this so far written on my script:
theta = [-20: 0.01: 20];
I = sin(10*pi*sin(theta)/(10*pi*sin(theta)))^2;
I2 = sin(5*pi*sin(theta)/(5*pi*sin(theta)))^2;
I3 = sin(pi*sin(theta)/(pi*sin(theta)))^2;
plot (theta,I)
hold on
plot (theta,I2)
plot (theta,I3)
xlim([-20 20]);
ylim([.5 1]);
legend('I, I2, I3')
xlabel ('x-axis')
ylabel ('y-axis')
hold off
It seems to just give me a straight line... I'm pretty sure I did the math right. Does anyone know where I went wrong?? It seems simple enough, but it's giving a hell of a lot of trouble.
0
Comments
.{operator} says do the operation elementwise.