b = 1;

edge = pi;
fx = linspace(-edge,edge,1000);
I = (sin(pi*b*fx)./fx).^2;
subplot(211);
plot(fx,I);
xlabel('f_x');
ylabel('Intensity of Fraunhofer pattern (arb. units)');
title('Profile of Fraunhofer diffraction from single slit (b=1)');
grid on;
subplot(212);
theta = linspace(-3*pi,3*pi,1000);
y1 = theta;
y2 = tan(theta);
plot(theta,y1);
hold on;
plot(theta,y2,'r');
ylim([-10 10]);
grid on;
title('Intersections represent the solutions of the transcendental equation \theta = tan(\theta)');
