MATLAB: How to make FOR loop for this following program.

for loop

Dear colleagues. Please help me to check this following program. I need to plot function oscy1 and oscx1 depend on the variable theta. However, these functions depend both on time t and angle theta. So I need to make 2 FOR loops for these.
Range of theta : 0 to 360 degree.
Range of time t: 0 to 1000.
for i=1:72
theta(1)=0;
theta(i+1)= theta(i)+5; %angle for incident light
thetarad(i)= theta(i)*pi/180;
for m=1:1000
t(1) = 1;
t(m+1) = t(m)+1;
c = 3*10^8; % speed of light
lambda = 1.55*10^-6; % wavelength
omega = 2*pi*c/lambda; %angular frequency
%phase_t = omega*t;
nrx = 1.52761; %refractive index X
nry = 1.53596; %refractive index Y
L = pi*lambda/((nry-nrx)*2*pi); % Half wavelength Polarization LHWP
omegat(m) = 0.01*(t(m)-1)*pi;
oscy1(m) = exp(j*omegat(m))*sin(thetarad(i))*exp(j*2*pi*L*nry/lambda);
oscx1(m) = exp(j*omegat(m))*cos(thetarad(i))*exp(j*2*pi*L*nrx/lambda);
aa(m) = real(oscx1(m));
bb(m) = real(oscy1(m));
end
Qin(i)=theta(i);
Qaa(i)=aa(?);
Qbb(i)=bb(?);
end

Best Answer

c = 3*10^8; % speed of light
lambda = 1.55*10^-6; % wavelength
omega = 2*pi*c/lambda; %angular frequency
nrx = 1.52761; %refractive index X
nry = 1.53596; %refractive index Y
L = pi*lambda/((nry-nrx)*2*pi); % Half wavelength Polarization LHWP
th = (0:5:360)*pi/180;
omt = 0.01*(0:99)'*pi;
e1 = exp(1i*2*pi*L/lambda);
aa = real(exp(1i*omt*sin(th))*e1^nry);
bb = real(exp(1i*omt*cos(th))*e1^nrx);
Related Question