Laser Rate Equation Using ODE45 in MATLAB?

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
2 replies · 3K views
vinny
Messages
3
Reaction score
0
Hi,
I've attached the problem that I'm trying to solve. I've also done the manual calculations to calculate Ithreshold. I'm not very good with MATLAB and I need MATLAB code for laser rate equations and I also need to plot LI characteristic of the laser.

I_th=qV/(η_i τ) N_th=qV/(η_i τ) (N_tr+(α_i+1/2L ln⁡〖1/(R_1 R_2 )〗)/Γa)=76.73mA

P_out=(η_i (I-I_th)〖⋅V〗_p⋅hν⋅α_m⋅v_g)/(qVν_g a(N_th-N_tr )-〖εη〗_i (I-I_th)).

Please help me out with the code using ode45. All your help is much appreciated.

Regards,
Vinny
 

Attachments

Physics news on Phys.org
function dy = rate_equation(t,y)
dy = zeros(2,1);
ni=0.9;
Lambda= 1.55*10^-6;
q= 1.602*10^-19;
V= 1.75*10^16;
a= 0.5*10^-20;
E= 1*10^-22;
Tau= 2.1*10^-9;
Ntr= 1*10^24;
Gamma= 0.3;
B= 1*10^-16;
Alphai= 3000;
Bsp= 1*10^-4;
ng= 3.7;
R1=0.32;
R2= 0.32;
L= 350*10^-6;
Alpham = (1/(2*L))*log(1/(R1*R2));
vg = (3*10^8/1.55*10^-6);
Taup = 1/(vg*(Alphai+Alpham));
Rsp=0;
I= 76.73e-3;

dy(1)=(ni*I)/q*V-y(1)/Tau- vg*a*((y(1)-Ntr)/(1+E*y(2)))*y(2);
dy(2) = Gamma*vg*a*((y(1)-Ntr)/(1+E*y(2)))*y(2)+Bsp*Gamma*Rsp-(y(2)/Taup);
end
is the function I wrote and when I use [T,Y] = ode45(@rate_equation,[0 10],[0 0]) the command window becomes non responsive. Please help me.
 
clear all
close all
clc

options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4 1e-5]);
[T,Y] = ode45(@rate_equation,[0 10],[0 0], options);
plot(T,Y(:,1));
title('carriers density in high laser level')
hold on;
When I run this I get the following errors

? Undefined function or method 'd' for input arguments of type 'char'.

Error in ==> rate_equation at 25
d y(1)=(ni*I)/q*V-y(1)/Tau- vg*a*((y(1)-Ntr)/(1+E*y(2)))*y(2);

Error in ==> odearguments at 109
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...

Error in ==> laser at 5
[T,Y] = ode45(@rate_equation,[0 10],[0 0], options);

Somebody?anybody?