|
楼主 |
发表于 2007-12-29 16:48
|
显示全部楼层
帮忙看看我编写的程序
你好校长,
附件中所带的是我自己编写的光学Bloch方程的Matlab成学,请您帮忙看看那块出现问题了,为什么加上边界脉冲传输不过去呢?
希望校长能给与帮助和修改!
谢谢!
- clear all
- clc
- %x_0=40e-9;
- %x_p=10e-9;
- t_0=200;
- t_p=20;
- Gamma_11=0;
- Gamma_L=0;
- mu_21=1e-30;
- %delt_21=0.05e15;
- n=1;
- c=3e8;
- h=6.26e-34;
- h_1=h/(2*pi);
- x_0=40e-9;
- %Omiga=2.35e12;
- lambda=801.5e-9;
- N=1e24;
- tau_c=630;
- delt_21=0.05;
- S=pi*(x_0/2)^2;
- T=100;
- nn=2^8;
- dt=T/nn;
- t=((1:nn)'-(nn+1)/2)*dt;
- w_00=5;
- dz=c/n*dt;
- z=((1:nn)'-(nn+1)/2)*dz;
- u=zeros(length(t),length(t));
- u(:,1)=0;
- v=zeros(length(t),length(t));
- v(:,1)=0;
- w=zeros(length(t),length(t));
- w(:,1)=-1;
- chi=zeros(length(t),length(t));
- chi(length(t),:)=mu_21*S/t_p/h_1*sech((t-t_0/t_p));
- chi(:,1)=1;
- g=zeros(length(t),1);
- g(:,1)=exp(-(t-t_0).^2/t_p^2);
- A=zeros(length(t),length(t));
- A(:,1)=0;
- hh=0.001;
- n=length(t);
- for a=1:10
- for j=1:length(t)-1;
-
- u_0(:,j+1)= u(:,j) + hh*dt*(-delt_21*u(:,j)- Gamma_L*v(:,j));
- v_0(:,j+1)= v(:,j) + hh*dt*(chi(:,j).*w(:,j)+ delt_21*u(:,j)- Gamma_L*v(:,j));
- w_0(:,j+1)= w(:,j) + hh*dt*(-chi(:,j).*v(:,j)- Gamma_11*w(:,j)+Gamma_11*w_00);
- %%%预估
- for k=1:length(g)-1;
- A1(:,j+1)=(v(:,j)+v_0(:,j+1)).*g(k)*dt+A(:,j);
- end
- A=A1;
- chi_0(:,j+1)=chi(:,j)+hh*dt*(1/(2*tau_c^2)*(A(:,j+1)+A(:,j))/2);
- %%%校正
- u(2:n,j+1)= u(1:n-1,j)- hh*dt/2*(delt_21*(v(1:n-1,j)+ v_0(2:n,j+1))+ Gamma_L*(u(1:n-1,j)+ u_0(2:n,j+1)));
- v(2:n,j+1)= v(1:n-1,j)+ hh*dt/2*(1/2*(chi_0(2:n,j+1)+chi(1:n-1,j)).*(w_0(2:n,j+1)+w(1:n-1,j))+ delt_21*(u(1:n-1,j)+u_0(2:n,j+1))- Gamma_L*(v(1:n-1,j)+v_0(2:n,j+1)));
- w(2:n,j+1)=w(1:n-1,j)-hh*dt*(1/4*(chi_0(2:n,j+1)+chi(1:n-1,j)).*(v_0(2:n,j+1)+v(1:n-1,j))-1/2*Gamma_11*(w(1:n-1,j)+w_0(2:n,j+1)+Gamma_11*w_00));
- chi(2:n,j+1)=chi(1:n-1,j)+hh*dt/(2*tau_c^2)*(chi_0(2:n,j+1)+chi(1:n-1,j))/2;
- E=chi*h_1/mu_21;
- end
- end
复制代码
[ 本帖最后由 sigma665 于 2007-12-29 17:00 编辑 ] |
|