Help Needed: MATLAB Code for Semiconductor Laser Rate Equation

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 4K views
almesba
Messages
5
Reaction score
0
Can anyone help me by giving MATLAB code to simulate semiconductor laser rate equation by finite difference methord. i wrote a code but that was not working. so i need it badly. please help me.
 
Last edited by a moderator:
Physics news on Phys.org
almesba said:
Can anyone help me by giving MATLAB code to simulate semiconductor laser rate equation by finite difference methord. i wrote a code but that was not working. so i need it badly. please help me.

No, sorry. We do not do your schoolwork for you. Perhaps if you post your code (like you did in your other thread), we may be able to spot any errors...
 
berkeman said:
No, sorry. We do not do your schoolwork for you. Perhaps if you post your code (like you did in your other thread), we may be able to spot any errors...

mmm=0;
for nW=[1 3 5]
mmm=mmm+1;
mm=0;
Lam=980e-9;
q=1.6e-19;
alpha=.2;
Tn=1;
Tp=2.8e1;
G0=0.6;
N0 = 1e24;
h=6.6e-34;
c=3e8;
Gamma=1e-5;
beta=1;
epsilon=1e-12;
Va=3.75e-14;
Ith=((q*Va)/Tn)*(N0+(1/(Gamma*G0*Tp)));
for I = 0.1e-3:0.1e-3:4.5e-3;
mm=mm+1;
tini=0;
tfin=4e-9;
dt=1e-12;
m=0;
N(1)=0;
S(1)=0;
for t=tini:dt:tfin
m=m+1;
delN=I/(q*Va)-N(m)/Tn-G0*(N(m)-N0)*S(m)/(1+epsilon*S(m));
delS=S(m)+Gamma*beta*N(m)/Tn+Gamma*(N(m)-N0)*S(m)/(1+epsilon*S(m));

N(m+1)=N(m)+dt*delN;
S(m+1)=S(m)+dt*delS;
P(m+1)=1000*Va*S(m)*h*c/(Lam*2*Gamma*Tp);
tt(m+1)=t;

end
II(mm)=I*1e3;
Po(mmm,mm)=sum(N(1:4000))/4000;
N1(mmm,mm)=sum(N(1:4000)/4000);

Po1(mmm,:)=P;
Nt(mmm,:)=N;
S1(mmm,:)=S;
end
end


tt=tt*1e-9;
figure(1)
plot(tt,N);
figure(2)
plot(tt,S);
 
What is "not working"? You really need to be more clear in your posts here on the PF.
 
berkeman said:
What is "not working"? You really need to be more clear in your posts here on the PF.

Thank you. I solved the problem.