% Book: Laser Electronics by Verdeyen
% Problem: Chapter 7 problem 1
% Script Author: meg noah meg_noah@student.uml.edu
function Lasers_Ch7_Pr1
p=9.5:0.1:10.0;
v=10.^p;c=3e10;Volume=2*5*6;d=6;
n=(8*pi*Volume*v.^3)/(3*c^3);

%allowed frequencies v=qc/2nd
q = fix((2*d/c).*v)
n2=zeros(size(p));
for i=1:size(p)
n2(i)=factorial(q(i));
end
plot(v,n,'b'),grid on;hold on;
plot(v,n2,'r'),grid on;hold on;
ylabel('Number of Modes');
xlabel('Frequency [Hz]');
v=10^5
n=(8*pi*Volume*v.^3)/(3*c^3)
q = (2*d/c).*v
