发布网友 发布时间:2022-04-21 05:35
共1个回答
热心网友 时间:2022-04-12 23:54
1. A=zeros(m.n);改成A=zeros(m,n); 2. canshu=X\Y;改成canshu=X\Y‘; 下面是偶改好的版本: a=8*10^(-5); c=3*10^8; l=1i*2*pi*a*10^12/c; n1=2+0.3i; n2=4+0.8i; n3=10+2i; f=(0.1:0.01:3); [m,n]=size(f); R=zeros(m,n); A=zeros(m,n); B=zeros(m,n); C=zeros(m,n); for k=1:n X=[-1,1,1,0; n1,n2,-n2,0; 0,exp(l*f(k)*n2),exp(-l*f(k)*n2),-exp(l*f(k)*n3); 0,n2*exp(l*f(k)*n3),-n2*exp(-l*f(k)*n3),-n3*exp(l*f(k)*n3)]; Y=[1,n1,0,0]; canshu=X\Y'; canshu1=canshu'; R(k)=canshu(1); A(k)=canshu(2); B(k)=canshu(3); C(k)=canshu(4); end figure,plot(f,abs(A),'black') %hold on figure,plot(f,abs(B),'red') %hold on figure,plot(f,abs(C),'blue') %hold on figure,plot(f,abs(R),'yellow')