plot the graph program

26 次查看(过去 30 天)
shiv gaur
shiv gaur 2022-1-6
program
l=6330*(10)^(-10);
k0=2*pi/l;
np=1.50;
n0=1.3707;
n1=1.3;
n2=1.59;
n3=1.45;
n4=3.46;
na=1.36;
t1=2.10e-6;
t2=0.198e-6;
t3=0.0012e-6;
t4=0.002e-6;
m=0;
max=0.01;
for a=11.392*(pi/180):0.1*(pi/180):80.264*(pi/180);
a1=a*(180/pi);
kx=k0*np.*sin(a);
k1=sqrt(n1.^2*k0^2-kx.^2);
k2=sqrt(n2.^2*k0^2-kx.^2);
k3=sqrt(n3.^2*k0^2-kx.^2);
k4=sqrt(n4.^2*k0^2-kx.^2);
m11= cos(t1*k1).*cos(t2*k2)-(k2./k1).*sin(t1*k1).*sin(t2*k2);
m12=(1/k2)*(cos(t1*k1)*sin(t2*k2)*1i) +(1/k1)*(cos(t2*k2)*sin(t1*k1)*1i);
m21= (k1)*cos(t2*k2)*sin(t1*k1)*1i +(k2)*cos(t1*k1)*sin(t2*k2)*1i;
m22=cos(t1*k1)*cos(t2*k2)-(k1/k2)*sin(t1*k1)*sin(t2*k2);
m34= cos(t3*k3)*cos(t4*k4)-(k4/k3)*sin(t3*k3)*sin(t4*k4);
m32=(1/k4)*(cos(t3*k3)*sin(t4*k4)*1i) +(1/k3)*(cos(t4*k4)*sin(t3*k3)*1i);
m23= (k3)*cos(t4*k4)*sin(t3*k3)*1i +(k4)*cos(t3*k3)*sin(t4*k4)*1i;
m33=cos(t3*k3)*cos(t4*k4)-(k3/k4)*sin(t3*k3)*sin(t4*k4);
M11=m11*m34+m12*m23;
M12=m11*m32+m12*m33;
M21=m21*m34+m22*m23;
M22=m21*m32+m22*m33;
g0=sqrt(kx.^2-k0^2*n0.^2);
ga= sqrt(kx.^2-k0^2*na.^2);
r=(na^2*g0*M11-n0^2*ga*M22+g0*ga*M12-na^2*n0^2*M21)./(na^2*g0*M11+n0^2*ga*M22+g0*ga*M12+na^2*n0^2*M21);
r1=conj(r);
rf=r.*r1;
if max< rf
max=rf;
end
end
for a=11.392*(pi/180):0.1*(pi/180):80.264*(pi/180);
m=m+1;
a1=a*(180/pi);
x(m)=a1;
x=(2*pi/l)*np*sin(a);
k1=sqrt(n1.^2*k0^2-kx.^2);
k2=sqrt(n2.^2*k0^2-kx.^2);
k3=sqrt(n3.^2*k0^2-kx.^2);
k4=sqrt(n4.^2*k0^2-kx.^2);
m11= cos(t1*k1).*cos(t2*k2)-(k2./k1).*sin(t1*k1).*sin(t2*k2);
m12=(1./k2)*(cos(t1*k1)*sin(t2*k2)*1i) +(1./k1)*(cos(t2*k2)*sin(t1*k1)*1i);
m21= (k1)*cos(t2*k2)*sin(t1*k1)*1i +(k2)*cos(t1*k1)*sin(t2*k2)*1i;
m22=cos(t1*k1)*cos(t2*k2)-(k1/k2)*sin(t1*k1)*sin(t2*k2);
m34= cos(t3*k3)*cos(t4*k4)-(k4/k3)*sin(t3*k3)*sin(t4*k4);
m32=(1/k4)*(cos(t3*k3)*sin(t4*k4)*1i) +(1/k3)*(cos(t4*k4)*sin(t3*k3)*1i);
m23= (k3)*cos(t4*k4)*sin(t3*k3)*1i +(k4)*cos(t3*k3)*sin(t4*k4)*1i;
m33=cos(t3*k3)*cos(t4*k4)-(k3/k4)*sin(t3*k3)*sin(t4*k4);
M11=m11*m34+m12*m23;
M12=m11*m32+m12*m33;
M21=m21*m34+m22*m23;
M22=m21*m32+m22*m33;
g0=sqrt(kx.^2-n0.^2*k0^2);
ga= sqrt(kx.^2-na.^2*k0^2);
r=(na^2*g0*M11-n0^2*ga*M22+g0*ga*M12-na^2*n0^2*M21)./(na^2*g0*M11+n0^2*ga*M22+g0*ga*M12+na^2*n0^2*M21);
r1=conj(r);
rf=r.*r1;
rf1=rf/max;
y(m)=rf1;
end
%plot(a,r)
x1=[]
y1=[]; %number of elements in x1 and y1 should be equal
plot(x,y,x1,y1,'rd');
  2 个评论
shiv gaur
shiv gaur 2022-1-6
plot between a vs rf1 pl help
Voss
Voss 2022-1-6
plot(11.392*(pi/180):0.1*(pi/180):80.264*(pi/180),y);

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by