how to write equation in matlab for E(t-tp) where the E is E(t) but introduce a tp delay time.

6 views (last 30 days)
ti = 0;
tf = 2.50E-9;
tspan=[ti tf];
y0=[0; 0];
[T,Y]= ode45(@(t,y) rate_eq(t,y),tspan,y0);
subplot 211
title('carrier population');
subplot 212
title('photon density ');
function dy = rate_eq(t,y)
dy = zeros(2,1);
V= 250E-18;
I = 0.3;
te = 2E-9; %carrier lifetime (recombination life time)
tp = 2E-12; %photon lifetime
r = 0.3; % optical confinement factor
a = 2.5E-20; % gain coefficent
B=10E-10; %radiative recombination time
c=3*10^8; % velocity of light
e = 1.602E-19; % e = electron charge
ug= 3.6; % refractive index
n0 = 1E24; % carier density at transparancy
% Carriers
dy(1) = (I/e) - (y(1)/V.*te) - (r*c*a*((y(1)/V)-n0)/ug)*y(2);
% Photons
dy(2) = (r*c*a*((y(1)/V)-n0)/ug)*y(2)- y(2)/tp + B*y(1)/V ;
in this the y(2) is P(t) what if i want to write the P(t-tp) where the tp is delayed time and tp =12E-12, how will these program modify.

Accepted Answer

Torsten on 7 Oct 2022
Edited: Torsten on 7 Oct 2022
You will need to make a change in the unit of time in your equations such that the delay time is in the order of 1 - it's not possible to handle a delay of 12E-12 by any ode integrator.
Furthermore, ode45 is not suited to solve delay differential equations. You will have to use dde23 instead.
Torsten on 7 Oct 2022
Edited: Torsten on 7 Oct 2022
thanks for the help, and can you please elaborate how to change the unit of time in equation for that
It's easy: Say the delay is 12e-12 seconds. If the unit for time in your equations is in seconds, then your delay term would be P(t-12e-12). If your time unit were seconds*1e-12, your delay term would be P(t*-12).
But thinking about it, I'm not sure if this really helps for the integration since 12/t* = 12e-12/t, and this is very small in both cases.

Sign in to comment.

More Answers (0)


Find more on Chemistry 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!

Translated by