Need to rectify error in my matlab code given below
syms t
mu=2500*(10^-4); %cm^2*V^-1 * s^-1
R = 0.318;
eta=377;% ohm
N=3.681; %refindex
Pavg=7;%W
Za=50;%ohm
g=100*(10^-6);%m
pi=3.14;
alpha= 8.5*(10^4); %m^-1
taul= 35*(10^-15); %s
tauc= 10*(10^-12); %s
W=100*(10^-6); %m
L=300*(10^-6); % m
Tlt=325*(10^-6); % m
V=25; %V
E=V./g;
vopt=375*(10^12); %Hz
e=1.602*(10^-19);
h=6.626*(10^-34);
I=0.90*(10^8);% i
t=linspace(-0.5*(10^-12),3.0*(10^-12),100);
n(t)=I.*exp(-2).*((1-R)./(sqrt(2.*pi).*h.*vopt)).*taul.*exp((-taul.^2)./(8.*tauc.^2)).*exp(-t./tauc).*(erf(sqrt(2).*t./taul – (sqrt(2).*taul)./(4.*tauc))+1);
tc = 10.*(10.^-12);
n0=10.^18
dt=80.*(10^-12);
G=n0.*exp((-t.*t)/(dt.*dt))
ode = diff(n,t) == (-n./tc) + G;
cond = n(0) == n0;
nSol(t)=dsolve(ode,cond);
It shows difference order N must be a positive integer. Error in third last line. How to solve this error?syms t
mu=2500*(10^-4); %cm^2*V^-1 * s^-1
R = 0.318;
eta=377;% ohm
N=3.681; %refindex
Pavg=7;%W
Za=50;%ohm
g=100*(10^-6);%m
pi=3.14;
alpha= 8.5*(10^4); %m^-1
taul= 35*(10^-15); %s
tauc= 10*(10^-12); %s
W=100*(10^-6); %m
L=300*(10^-6); % m
Tlt=325*(10^-6); % m
V=25; %V
E=V./g;
vopt=375*(10^12); %Hz
e=1.602*(10^-19);
h=6.626*(10^-34);
I=0.90*(10^8);% i
t=linspace(-0.5*(10^-12),3.0*(10^-12),100);
n(t)=I.*exp(-2).*((1-R)./(sqrt(2.*pi).*h.*vopt)).*taul.*exp((-taul.^2)./(8.*tauc.^2)).*exp(-t./tauc).*(erf(sqrt(2).*t./taul – (sqrt(2).*taul)./(4.*tauc))+1);
tc = 10.*(10.^-12);
n0=10.^18
dt=80.*(10^-12);
G=n0.*exp((-t.*t)/(dt.*dt))
ode = diff(n,t) == (-n./tc) + G;
cond = n(0) == n0;
nSol(t)=dsolve(ode,cond);
It shows difference order N must be a positive integer. Error in third last line. How to solve this error? syms t
mu=2500*(10^-4); %cm^2*V^-1 * s^-1
R = 0.318;
eta=377;% ohm
N=3.681; %refindex
Pavg=7;%W
Za=50;%ohm
g=100*(10^-6);%m
pi=3.14;
alpha= 8.5*(10^4); %m^-1
taul= 35*(10^-15); %s
tauc= 10*(10^-12); %s
W=100*(10^-6); %m
L=300*(10^-6); % m
Tlt=325*(10^-6); % m
V=25; %V
E=V./g;
vopt=375*(10^12); %Hz
e=1.602*(10^-19);
h=6.626*(10^-34);
I=0.90*(10^8);% i
t=linspace(-0.5*(10^-12),3.0*(10^-12),100);
n(t)=I.*exp(-2).*((1-R)./(sqrt(2.*pi).*h.*vopt)).*taul.*exp((-taul.^2)./(8.*tauc.^2)).*exp(-t./tauc).*(erf(sqrt(2).*t./taul – (sqrt(2).*taul)./(4.*tauc))+1);
tc = 10.*(10.^-12);
n0=10.^18
dt=80.*(10^-12);
G=n0.*exp((-t.*t)/(dt.*dt))
ode = diff(n,t) == (-n./tc) + G;
cond = n(0) == n0;
nSol(t)=dsolve(ode,cond);
It shows difference order N must be a positive integer. Error in third last line. How to solve this error? ode MATLAB Answers — New Questions