#### sohiltri

##### Member level 5

clear all;

vact=0.8427e-16; %active volume of laser cavity

gco=8.0e-11; %gain constant

Nctr=0.59e23; %transparency electron density

tn=3e-9; %spontaneous recombination lifetime

tp=0.7e-12; %photon lifetime

beeta=1e-3; %fraction of spontaneous emission coupled into lasing mode

gamma=0.4; %optical confinement factor

epsilon=2.0e-23; %gain compression fator

Nm=9; %number of side modes

lambdaocw=1.3e-6; %max gain wave length

k=.083e-9; %wavelength change per degree kelvin

dellambda=8; %gain line width

n=2; %ideality factor

Rs=5.6; %effective series diode resistance

Tol=30; %leakage current characteristic temp

Cleak=2.27e-6; %leakage current proportionality constant

Toa=100; %active region charcterstic temp

Rther=100; %effective thermal diode resistance

q=1.6e-19;

lambdai=1310e-9;

Tcw=300; %reference temp

Nc=4.35e23; %intrinsic carrier density gallium arsenide

Nv=7.57e18;

h=1.05457e-34; %planks constant

c=3e8; %velocity of light

Ntr='Nctr*exp(-T/Toa)';

NcT='Nc*(T/300)^1.5';

NvT='Nv*(T/300)^1.5';

Eg='1.519-(5.405e-4*T^2)/(T+204)';

Ne='((NcT*NvT)^0.5)*exp(-Eg/(2*k*T))';

Ne=subs(Ne,'NvT',NvT);

Ne=subs(Ne,'NcT',NcT);

Ne=subs(Ne,'Eg',Eg);

Tdin='Td-T+Rther*Rs*(q*vact*N/tn)^2+(n*k*Td*vact*N/tn)*log((N/Ne)+1)';

[Td]=solve(Tdin,'Td');

goi='gco*exp(-T/Toa)*(1-4*((lambdai-(lambdaocw+k*(Td-Tcw)))/dellambda)^2)';

goi=subs(goi,'Td',Td(1));

Sin='goi/(1+epsilon*S)*gamma*(N-Ntr)*S-S/tp+beeta*gamma*N/tn';

Nin='I/(q*vact)-goi*(N-Ntr)*S/(1+epsilon*S)-N/tn';

Nin=subs(Nin,'S',S(1));

Nin=subs(Nin,'goi',goi);

Nin=subs(Nin,'Ne',Ne);

Nin=subs(Nin,'Ntr',Ntr);

Nin=subs(Nin);

Nin=vpa(Nin,10);

I=0:0.1e-3:60e-3;

T=[283 298 323 243];

for x=1:length(T),

S1=subs(Nin,'T',T(x));

for y=1:length(I),

S2=subs(S1,'I',I);

S2=vpa(S2,10);

[S3]=solve(S2,'N');

t(y,x)=0+1*i;

for z=1:length(S3),

if(isreal(S3(z)) && double(S3(z))>=0),

t(y,x)=z;

end

end

if(isreal(t(y,x))),

N(y,x)=double(S3(t(y,x)));

else

N(y,x)=0;

end

end

end

There is some problem in solvin this differential equation.... It is not able to solve for N even after subtitutin all varialbles....Please help me to rectify error or give some other suggestion to solve this code.....It doesnt give any error but to solve for single current value I and single temperature T , it runs out of my physical memory...which is set at 1900MB....