matlab“Inner matrix dimensions must agree.”这个错误怎么改啊Error using ==> mtimesInner matrix dimensions must agree.程序如下:n1=1.385;n2=1.3476;r=0.75:(1.24-0.75)/50:1.24;d=r*2;derta=2.5;lamda=0.537;x=1-(n2/n1)^2;V=2*pi*r*n1/lamda*s

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 15:57:05
matlab“Innermatrixdimensionsmustagree.”这个错误怎么改啊Errorusing==>mtimesInnermatrixdimensionsmustagree.程序如

matlab“Inner matrix dimensions must agree.”这个错误怎么改啊Error using ==> mtimesInner matrix dimensions must agree.程序如下:n1=1.385;n2=1.3476;r=0.75:(1.24-0.75)/50:1.24;d=r*2;derta=2.5;lamda=0.537;x=1-(n2/n1)^2;V=2*pi*r*n1/lamda*s
matlab“Inner matrix dimensions must agree.”这个错误怎么改啊
Error using ==> mtimes
Inner matrix dimensions must agree.
程序如下:
n1=1.385;
n2=1.3476;
r=0.75:(1.24-0.75)/50:1.24;d=r*2;
derta=2.5;
lamda=0.537;
x=1-(n2/n1)^2;
V=2*pi*r*n1/lamda*sqrt(x);
%U=-0.0069386*V.^4+0.009919*V.^3.-0.56462*V.^2+1.6324*V-0.16091;
U=2.405*exp(-(1-x/2)*V);
W=sqrt(abs(V.^2-U.^2));
p=sqrt(x).*U.^2.*besselk(0,W.*derta./r);
q=r.*V.^3.*besselk(1,W).^2;
c=p./q;
a=10*log10(c);
%c=(sqrt(x).*U.^2*besselk(0,W.*derta/r).)/(r*V.^3*besselk(1,W).^2)
z=0:10000/50:10000
B=sqrt((2*pi/lamda)^2-U.^2/r.^2)
A1=1 ;A2=0; A3=0;
%A2=1 ;A1= 0;A3=0;
q1=0.5;q2=0.25;q3=0.25;
A1=q1*exp(i*B.*z)+q2*exp(- i*( B+ sqrt(2)*c)*z) +q3exp(- i*( B- sqrt(2)* c)* z);
A2=sqrt(2)*q2*exp(- i*( B+ sqrt(2)*c)*z) -sqrt(2)*q3exp(- i*( B- sqrt(2)* c)* z);
A3=-q1*exp(i*B.*z)+q2*exp(- i*( B+ sqrt(2)*c)*z) +q3exp(- i*( B- sqrt(2)* c)* z);
P1 = abs(A1).^2;
P2 = abs(A2).^2;
P3 = abs(A3).^2;
plot(z,P1,z,P2,z,P3)
xlabel('diameter(um)');
ylabel('crosstalk');
grid on

matlab“Inner matrix dimensions must agree.”这个错误怎么改啊Error using ==> mtimesInner matrix dimensions must agree.程序如下:n1=1.385;n2=1.3476;r=0.75:(1.24-0.75)/50:1.24;d=r*2;derta=2.5;lamda=0.537;x=1-(n2/n1)^2;V=2*pi*r*n1/lamda*s

% z 向量要用点乘,q3 后差乘号

% A1=q1*exp(i*B.*z)+q2*exp(- i*( B+ sqrt(2)*c).*z) +q3*exp(- i*( B- sqrt(2)* c).* z);

% A2=sqrt(2)*q2*exp(- i*( B+ sqrt(2)*c).*z) -sqrt(2)*q3*exp(- i*( B- sqrt(2)* c).* z);

% A3=-q1*exp(i*B.*z)+q2*exp(- i*( B+ sqrt(2)*c).*z) +q3*exp(- i*( B- sqrt(2)* c).* z);