MATLAB: How to plot this

MATLABplot

Can you please help me with this
theta=0:10:90;
n= 1.6+3i
e1=1-(((n.^2-(sin(theta)).^2 ).^0.5-cos(theta))/((n.^2-sin(theta).^2).^0.5+cos(theta))).^2;
e2=1-(n.^2-cos(theta)-(n.^2-(sin(theta)).^2).^0.5/(n.^2-cos(theta)+(n.^2-(sin(theta)).^2).^0.5)).^2;
rho= (e1-e2)/(e1+e2)
plot(theta,rho)

Best Answer

You have to vectorise your expressions, then decide how you want to plot your data:
theta=0:10:90;
n= 1.6+3i
e1=1-(((n.^2-(sin(theta)).^2 ).^0.5-cos(theta))./((n.^2-sin(theta).^2).^0.5+cos(theta))).^2;
e2=1-(n.^2-cos(theta)-(n.^2-(sin(theta)).^2).^0.5./(n.^2-cos(theta)+(n.^2-(sin(theta)).^2).^0.5)).^2;
rho= (e1-e2)./(e1+e2);
figure(1)
subplot(3,1,1)
plot(theta,real(rho))
grid
title('\Re \rho')
subplot(3,1,2)
plot(theta,imag(rho))
title('\Im \rho')
grid
subplot(3,1,3)
plot(theta, abs(rho))
title('|\rho|')
grid