Having problem with the ode45 solver
Show older comments
I'm trying to solve rate equations for a fabry-perot laser using ode45 solver, but I'm having issues. I'm basically new to solving this kind of problems using ode, so Im not sure if it is just me doing something wrong. I've tried different builds with pretty much the same output, the solver appears to get stuck somewhere (or maybe it just takes a looong time to handle it). The easier to read version should be this one:
%constants
c=2.99*10^5; %m/s
beta=10^-6;
d=5*10^-6; %m
tau_rr=100*10^-9; %s
tau_tot=tau_rr+10^-3; %s
L=500*10^-6; %m
R1=0.33;
R2=0.33;
J=28*10^3; %KA/cm^2
e=1.602*10^-19;
n_tilde=3.6;
gamma=10; %cm^-1
nt=10^18; %cm^-3
a=10^17; %cm
p=1;
% Initial Condition
N0=10;
n0=10^3;
gth=gamma+(1/(2*L))*log(1/(R1*R2))
tau_ph=(c/n_tilde)*(gamma+((1/(2*L))*log(1/(R1*R2))));
f = @(t,x) [(c/n_tilde)*a*(x(2)-nt)*x(1)+(x(2)*beta/tau_rr)-x(1)/tau_ph;-(c/n_tilde)*a*(x(2)-nt)*x(1)-x(2)/tau_tot+J/(e*d)];
[t,xa] = ode45(f,[0 p],[N0 n0]);
As I said it appears to get stuck, is it something I messed up in the code itself or I'm doing something wrong in the approach I'm taking? Thanks everyone for your help
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!