matlab中的问题
此程序没错na=2.10;nb=1.46;n1=1;n2=1;ford=400:1600;c3=0;c1=asin(n1*sin(c3)/na);c2=asin(na*s...
此程序没错
na=2.10;nb=1.46;n1=1;n2=1;
for d=400:1600;
c3=0;c1=asin(n1*sin(c3)/na);c2=asin(na*sin(c1)/nb);c4=asin(nb*sin(c2)/n2);
d1=1064;
a=d1/(4*na);b=d1/(4*nb);
Ba=2*pi*na*a*cos(c1)/d;
Bb=2*pi*nb*b*cos(c2)/d;
f=4*pi*1e-7;
e=1e-9/(36*pi);
m=sqrt(e/f);
za=m*cos(c1)*na;zb=m*cos(c2)*nb;z1=f*cos(c3)*n1;z2=f*cos(c4)*n2;
p1=cos(Bb);p2=-i*sin(Bb)/zb;p3=-i*zb*sin(Bb);p4=cos(Bb);
P=[p1 p2;p3 p4];
q1=cos(Ba);q2=-i*sin(Ba)/za;q3=-i*za*sin(Ba);q4=cos(Ba);
Q=[q1 q2;q3 q4];
O=Q*P;O1=O^27;
O11=O1(1,1);O12=O1(1,2);O13=O1(2,1);O14=O1(2,2);
z1=sqrt(e/f)*n1*cos(c3);z2=sqrt(e/f)*n2*cos(c4);
t=2*z1/(z1*(O11+z2*O12)+O13+z2*O14);
r=(z1*(O11+z2*O12)-O13-z2*O14)/(z1*(O11+z2*O12)+O13+z2*O14);
t1=abs(t);
r1=abs(r);
s=d-399;
k(1,s)=t1;
end
d=400:1600;
plot(d,k)
为什么我把d的范围和d1的值改了一下又不能运行呢?错误:On line 32 ==> plot(d,k),修改的地方以换行表示
na=1.926;nb=3.23;n1=1;n2=1;nc=1.585;nd=3.55;
for d=1100:1800;
c3=0;c1=asin(n1*sin(c3)/na);c2=asin(na*sin(c1)/nb);c4=asin(nb*sin(c2)/n2);
cc=asin(nc*sin(c3)/na);cd=asin(nd*sin(c3)/na);
d1=1550;
a=d1/(4*na);b=d1/(4*nb);c=d1/(4*nc);dd=d1/(4*nd);
Ba=2*pi*na*a*cos(c1)/d;
Bb=2*pi*nb*b*cos(c2)/d;Bc=2*pi*nc*c*cos(cc)/d;
Bd=2*pi*nd*dd*cos(cd)/d;
f=4*pi*1e-7;
e=1e-9/(36*pi);
m=sqrt(e/f);
za=m*cos(c1)*na;zb=m*cos(c2)*nb;z1=f*cos(c3)*n1;z2=f*cos(c4)*n2;
zc=m*cos(cc)*nc;zd=m*cos(cd)*nd;
p1=cos(Bb);p2=-i*sin(Bb)/zb;p3=-i*zb*sin(Bb);p4=cos(Bb);
P=[p1 p2;p3 p4];
q1=cos(Ba);q2=-i*sin(Ba)/za;q3=-i*za*sin(Ba);q4=cos(Ba);
Q=[q1 q2;q3 q4];
c1=cos(Bc);c2=-i*sin(Bc)/zc;c3=-i*zc*sin(Bc);c4=cos(Bc);C=[c1 c2;c3 c4];
d1=cos(Bd);d2=-i*sin(Bd)/zd;d3=-i*zb*sin(Bd);d4=cos(Bd);D=[d1 d2;d3 d4];
O1=Q*P*Q*P*C*P*Q*D*Q*D *C* D*Q*D*Q*P*C*P*Q*P*Q;
O11=O1(1,1);O12=O1(1,2);O13=O1(2,1);O14=O1(2,2);
z1=sqrt(e/f)*n1*cos(c3);z2=sqrt(e/f)*n2*cos(c4);
t=2*z1/(z1*(O11+z2*O12)+O13+z2*O14);
r=(z1*(O11+z2*O12)-O13-z2*O14)/(z1*(O11+z2*O12)+O13+z2*O14);
t1=abs(t);
r1=abs(r);
s=d-1099;
k(1,s)=t1;
end
d=1100:1800;
plot(d,k)
另polt后面加不加分号有关系吗? 展开
na=2.10;nb=1.46;n1=1;n2=1;
for d=400:1600;
c3=0;c1=asin(n1*sin(c3)/na);c2=asin(na*sin(c1)/nb);c4=asin(nb*sin(c2)/n2);
d1=1064;
a=d1/(4*na);b=d1/(4*nb);
Ba=2*pi*na*a*cos(c1)/d;
Bb=2*pi*nb*b*cos(c2)/d;
f=4*pi*1e-7;
e=1e-9/(36*pi);
m=sqrt(e/f);
za=m*cos(c1)*na;zb=m*cos(c2)*nb;z1=f*cos(c3)*n1;z2=f*cos(c4)*n2;
p1=cos(Bb);p2=-i*sin(Bb)/zb;p3=-i*zb*sin(Bb);p4=cos(Bb);
P=[p1 p2;p3 p4];
q1=cos(Ba);q2=-i*sin(Ba)/za;q3=-i*za*sin(Ba);q4=cos(Ba);
Q=[q1 q2;q3 q4];
O=Q*P;O1=O^27;
O11=O1(1,1);O12=O1(1,2);O13=O1(2,1);O14=O1(2,2);
z1=sqrt(e/f)*n1*cos(c3);z2=sqrt(e/f)*n2*cos(c4);
t=2*z1/(z1*(O11+z2*O12)+O13+z2*O14);
r=(z1*(O11+z2*O12)-O13-z2*O14)/(z1*(O11+z2*O12)+O13+z2*O14);
t1=abs(t);
r1=abs(r);
s=d-399;
k(1,s)=t1;
end
d=400:1600;
plot(d,k)
为什么我把d的范围和d1的值改了一下又不能运行呢?错误:On line 32 ==> plot(d,k),修改的地方以换行表示
na=1.926;nb=3.23;n1=1;n2=1;nc=1.585;nd=3.55;
for d=1100:1800;
c3=0;c1=asin(n1*sin(c3)/na);c2=asin(na*sin(c1)/nb);c4=asin(nb*sin(c2)/n2);
cc=asin(nc*sin(c3)/na);cd=asin(nd*sin(c3)/na);
d1=1550;
a=d1/(4*na);b=d1/(4*nb);c=d1/(4*nc);dd=d1/(4*nd);
Ba=2*pi*na*a*cos(c1)/d;
Bb=2*pi*nb*b*cos(c2)/d;Bc=2*pi*nc*c*cos(cc)/d;
Bd=2*pi*nd*dd*cos(cd)/d;
f=4*pi*1e-7;
e=1e-9/(36*pi);
m=sqrt(e/f);
za=m*cos(c1)*na;zb=m*cos(c2)*nb;z1=f*cos(c3)*n1;z2=f*cos(c4)*n2;
zc=m*cos(cc)*nc;zd=m*cos(cd)*nd;
p1=cos(Bb);p2=-i*sin(Bb)/zb;p3=-i*zb*sin(Bb);p4=cos(Bb);
P=[p1 p2;p3 p4];
q1=cos(Ba);q2=-i*sin(Ba)/za;q3=-i*za*sin(Ba);q4=cos(Ba);
Q=[q1 q2;q3 q4];
c1=cos(Bc);c2=-i*sin(Bc)/zc;c3=-i*zc*sin(Bc);c4=cos(Bc);C=[c1 c2;c3 c4];
d1=cos(Bd);d2=-i*sin(Bd)/zd;d3=-i*zb*sin(Bd);d4=cos(Bd);D=[d1 d2;d3 d4];
O1=Q*P*Q*P*C*P*Q*D*Q*D *C* D*Q*D*Q*P*C*P*Q*P*Q;
O11=O1(1,1);O12=O1(1,2);O13=O1(2,1);O14=O1(2,2);
z1=sqrt(e/f)*n1*cos(c3);z2=sqrt(e/f)*n2*cos(c4);
t=2*z1/(z1*(O11+z2*O12)+O13+z2*O14);
r=(z1*(O11+z2*O12)-O13-z2*O14)/(z1*(O11+z2*O12)+O13+z2*O14);
t1=abs(t);
r1=abs(r);
s=d-1099;
k(1,s)=t1;
end
d=1100:1800;
plot(d,k)
另polt后面加不加分号有关系吗? 展开
1个回答
展开全部
更多追问追答
追问
谢谢解答,很受用。另外第一个所给的程序运行出来的透射谱的值是不超过1的,为什么第二个程序透射谱就超出1了呢,照道理按照透射谱公式计算是不会错的呀
追答
na=1.926;nb=3.23;n1=1;n2=1;nc=1.585;nd=3.55;这些参数的取值有什么规律吗?如果没得话,难免会出现大于1的值。如果出现了大于1的值,给它进行归一化一下,即除以它的最大值。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询