MATLAB仿真程序求修改,急%yimian tongxiang%m=2.4*W0;s1=2*beta*W0,s2=-2*beta*W0clear; W0=1; A2=1;A1=A2;%z=linspace(0,2*pi,128); x=linspace(-5,5,128);y=x;[X,Y]=meshgrid(x,y);%[X,Z]=meshgrid(x,z);Z=0;m=[0,1.8,2.6,3.1];%V1=-m/(W0)^2.*sin(Z);V2=-m/(
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/05 16:05:46
MATLAB仿真程序求修改,急%yimian tongxiang%m=2.4*W0;s1=2*beta*W0,s2=-2*beta*W0clear; W0=1; A2=1;A1=A2;%z=linspace(0,2*pi,128); x=linspace(-5,5,128);y=x;[X,Y]=meshgrid(x,y);%[X,Z]=meshgrid(x,z);Z=0;m=[0,1.8,2.6,3.1];%V1=-m/(W0)^2.*sin(Z);V2=-m/(
MATLAB仿真程序求修改,急
%yimian tongxiang
%m=2.4*W0;s1=2*beta*W0,s2=-2*beta*W0
clear; W0=1;
A2=1;A1=A2;
%z=linspace(0,2*pi,128);
x=linspace(-5,5,128);y=x;
[X,Y]=meshgrid(x,y);
%[X,Z]=meshgrid(x,z);
Z=0;m=[0,1.8,2.6,3.1];
%V1=-m/(W0)^2.*sin(Z);V2=-m/(W0)^2.*sin(Z)-v.*cos(Z);
for k=1:4
t=m(k);
Z=t;
x01=2.4*W0*cos(Z)+2*W0*sin(Z);
x02=-2*W0*sin(Z);
u1=-2.4*W0/(W0)^2*sin(Z)+2*W0/(W0)^2*cos(Z);
u2=-2*W0/(W0)^2*cos(Z);
arfa=-0.56*sin(2*Z)-2.4*cos(2*Z) ;
Theta=-1*Z+arfa;
E1=A1*exp((-(X+x01).^2-(Y+x02).^2)/2).*exp(-i*(u1.*X+u2.*Y)).*exp(i*Theta);
E2=A2*exp((-(X-x01).^2-(Y-x02).^2)/2).*exp(i*(u1.*X+u2.*Y)).*exp(i*Theta);
%E=abs(E1-E2).^2;
subplot(1,4,k),
E=abs(E1+E2).^2;
pcolor(X,Y,E)
shading interp
end
%%colormap hot
%colorbar
这是原来的仿真程序,里面有2束光,现要求修改为3束光的程序.
MATLAB仿真程序求修改,急%yimian tongxiang%m=2.4*W0;s1=2*beta*W0,s2=-2*beta*W0clear; W0=1; A2=1;A1=A2;%z=linspace(0,2*pi,128); x=linspace(-5,5,128);y=x;[X,Y]=meshgrid(x,y);%[X,Z]=meshgrid(x,z);Z=0;m=[0,1.8,2.6,3.1];%V1=-m/(W0)^2.*sin(Z);V2=-m/(
%yimian tongxiang
%m=2.4*W0;s1=2*beta*W0,s2=-2*beta*W0
clear;
W0=1;
A2=1;
A1=A2;
A3=1;
%z=linspace(0,2*pi,128);
x=linspace(-5,5,128);
y=x;
[X,Y]=meshgrid(x,y);
%[X,Z]=meshgrid(x,z);
Z=0;
m=[0,1.8,2.6,3.1];
%V1=-m/(W0)^2.*sin(Z);V2=-m/(W0)^2.*sin(Z)-v.*cos(Z);
for k=1:4
t=m(k);
Z=t;
x01=2.4*W0*cos(Z)+2*W0*sin(Z);
x02=-2*W0*sin(Z);
u1=-2.4*W0/(W0)^2*sin(Z)+2*W0/(W0)^2*cos(Z);
u2=-2*W0/(W0)^2*cos(Z);
arfa=-0.56*sin(2*Z)-2.4*cos(2*Z) ;
Theta=-1*Z+arfa;
E1=A1*exp((-(X+x01).^2-(Y+x02).^2)/2).*exp(-i*(u1.*X+u2.*Y)).*exp(i*Theta);
E2=A2*exp((-(X-x01).^2-(Y-x02).^2)/2).*exp(i*(u1.*X+u2.*Y)).*exp(i*Theta);
E3=A3*exp((-(X-x02).^2-(Y-x01).^2)/2).*exp(i*(u1.*X+u2.*Y)).*exp(i*Theta);
%E=abs(E1-E2).^2;
subplot(1,4,k),
E=abs(E1+E2+E3).^2;
pcolor(X,Y,E)
shading interp
end
%%colormap hot
%colorbar
有3个光束了.只是在for循环里多了个E3而已,不过不知具体情况,随便写了个E3的表达式.楼主自己改改吧.