MATLAB矩阵相乘老是错误>> clear>> n1=2.8;n2=1.4;d1=138;d2=276;d=d1+d2;lamda=1000:1:2000;delta1=2*pi*n1*d1/lamda;delta2=2*pi*n2*d2/lamda;M1=[cos(delta1) i*sin(delta1)/n1;i*n1*sin(delta1) cos(delta1)];M2=[cos(delta2) i*sin(delta2)/n2;i*n2*sin(de
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 01:18:27
MATLAB矩阵相乘老是错误>> clear>> n1=2.8;n2=1.4;d1=138;d2=276;d=d1+d2;lamda=1000:1:2000;delta1=2*pi*n1*d1/lamda;delta2=2*pi*n2*d2/lamda;M1=[cos(delta1) i*sin(delta1)/n1;i*n1*sin(delta1) cos(delta1)];M2=[cos(delta2) i*sin(delta2)/n2;i*n2*sin(de
MATLAB矩阵相乘老是错误
>> clear
>> n1=2.8;
n2=1.4;
d1=138;
d2=276;
d=d1+d2;
lamda=1000:1:2000;
delta1=2*pi*n1*d1/lamda;
delta2=2*pi*n2*d2/lamda;
M1=[cos(delta1) i*sin(delta1)/n1;i*n1*sin(delta1) cos(delta1)];
M2=[cos(delta2) i*sin(delta2)/n2;i*n2*sin(delta2) cos(delta2)];
M=((M1)*(M2))^6;
矩阵到底哪里错了,应该怎么改
MATLAB矩阵相乘老是错误>> clear>> n1=2.8;n2=1.4;d1=138;d2=276;d=d1+d2;lamda=1000:1:2000;delta1=2*pi*n1*d1/lamda;delta2=2*pi*n2*d2/lamda;M1=[cos(delta1) i*sin(delta1)/n1;i*n1*sin(delta1) cos(delta1)];M2=[cos(delta2) i*sin(delta2)/n2;i*n2*sin(de
delta1=2*pi*n1*d1/lamda;
delta2=2*pi*n2*d2/lamda;
这两部,lamda是个向量,一个数没法这样除以一个向量,应该改为点除,做单元运算:
delta1=2*pi*n1*d1./lamda;
delta2=2*pi*n2*d2./lamda;
顺便说一下,这样改之后M=((M1)*(M2))^6;也不对
因为M1和M2完全不满足矩阵乘法时矩阵的要求