Help Needed: MATLAB Code for Semiconductor Laser Rate Equation

Click For Summary

Discussion Overview

The discussion revolves around seeking assistance with MATLAB code for simulating the semiconductor laser rate equation using the finite difference method. Participants express difficulties with their existing code and seek help to troubleshoot and refine their approach.

Discussion Character

  • Homework-related
  • Technical explanation

Main Points Raised

  • One participant requests MATLAB code to simulate the semiconductor laser rate equation, indicating their code is not functioning as intended.
  • Another participant responds by stating that they do not assist with schoolwork unless the original code is provided for review.
  • A participant shares a detailed MATLAB code snippet, outlining the parameters and calculations involved in the simulation, including variables such as current, gain, and photon density.
  • Questions arise regarding the clarity of the initial request, with participants suggesting that more specific information about the issues encountered would be helpful.
  • A later reply indicates that the initial poster has resolved their problem, but does not specify how.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the specific issues with the code, as the original poster's problem remains vague. There is no agreement on the effectiveness of the provided code, as the initial poster has not elaborated on their resolution.

Contextual Notes

The discussion lacks detailed information about the specific errors encountered in the original code, which limits the ability to provide targeted assistance. Additionally, the resolution mentioned by the original poster is not elaborated upon, leaving the nature of the problem unresolved.

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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
Replies
6
Views
4K
Replies
5
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 0 ·
Replies
0
Views
299