www.pudn.com > EDFA-980nm.zip > Untitled.m, change:2014-10-10,size:1500b


clear 
clc 
% 所有未注明的值的单位为标准国际单位 
% 调取函数 VUA01 VUA11 afs axs 
% 常用参数 国际标准单位 
c=2.99793e8;h0=6.62606896e-34;v=1.25e12;t=100;%上能级粒子寿命的倒数,单位hz 
bp=1480e-9;vp=c./bp;bs=1550e-9;vs=c./bs; 
ap=3/4.343;gp=1.1/4.343;lp=0;as=3.3/4.343;gs=4.8/4.343;ls=0;BN=3e15; 
Ps=1e-7;Pa=0;Pp=80e-3; 
L=20; 
nc=100;dh=L/nc; 
yps=zeros(1,nc+1);ypa=zeros(1,nc+1);ypp=zeros(1,nc+1); 
yps(1)=Ps;ypa(1)=Pa;ypp(1)=Pp; 
n2=zeros(1,nc); 
for x=1:nc 
    n2(x)=(ypp(x)*ap/(h0*vp*BN)+(yps(x)+ypa(x))*as/(h0*vs*BN))/(t+(ypp(x)*(ap+gp)/(h0*vp*BN)+(yps(x)+ypa(x))*(as+gs)/(h0*vs*BN))); 
    %计算泵浦的功率 
    pp1=ypp(x).*(n2(x)*(ap+gp)-ap-lp); 
    pp2=(ypp(x)+(dh/2).*pp1).*(n2(x)*(ap+gp)-ap-lp); 
    pp3=(ypp(x)+(dh/2).*pp2).*(n2(x)*(ap+gp)-ap-lp); 
    pp4=(ypp(x)+(dh).*pp3).*(n2(x)*(ap+gp)-ap-lp); 
    ypp(x+1)=ypp(x)+(dh/6).*(pp1+2*pp2+2*pp3+pp4); 
    %计算信号的功率 
    ps1=yps(x).*(n2(x)*(as+gs)-as-ls); 
    ps2=(yps(x)+(dh/2).*ps1).*(n2(x)*(as+gs)-as-ls); 
    ps3=(yps(x)+(dh/2).*ps2).*(n2(x)*(as+gs)-as-ls); 
    ps4=(yps(x)+(dh).*ps3).*(n2(x)*(as+gs)-as-ls); 
    yps(x+1)=yps(x)+(dh/6).*(ps1+2*ps2+2*ps3+ps4); 
    %计算ASE的功率 
    pa1=ypa(x).*(n2(x)*(as+gs)-as-ls)+gs*2*h0*vs*v*n2(x); 
    pa2=(ypa(x)+(dh/2).*pa1).*(n2(x)*(as+gs)-as-ls)+gs*2*h0*vs*v*n2(x); 
    pa3=(ypa(x)+(dh/2).*pa2).*(n2(x)*(as+gs)-as-ls)+gs*2*h0*vs*v*n2(x); 
    pa4=(ypa(x)+(dh).*pa3).*(n2(x)*(as+gs)-as-ls)+gs*2*h0*vs*v*n2(x); 
    ypa(x+1)=ypa(x)+(dh/6).*(pa1+2*pa2+2*pa3+pa4); 
end