jy00295005
2009-06-17, 07:43
我在用ode45时matlab显示busy,不知大家有没有心得,该怎么解决,我把代码贴出来看下,variables比较多。帮忙看下。
function:
function [dy] = rate_equation3(t,y)
dy = zeros(4,1);
Gn = 2.2e-19;
gcf=5.2e-20; %gcf=gain compression factor
cff=0.746; %confinement factor
alpha=6.5; %linewidth enhancemnet factor
q = 1.6e-19; % electron charge
v = 3.75e-14; % modal volume
I = 2.5; %constant input current
tua_p = 2.05e-12; %photo life time
tua_e = 0.126e-9; %carrier life time
N0 = 3.0e21; %carrier density at transparency
g = Gn*(y(2)-N0)*(1-gcf*y(3)); %nonliear gain expression
%E(t)
dy(1)=0.5*(cff*g-1/tua_p)*y(1)+i*alpha/2*(cff*gcf*(y(2)-N0)-tua_p)*y(1);
%N(t)
dy(2)=I/(q*v)-y(2)/tua_e-g*y(3);
%S(t)
dy(3)=abs(y(1).^2);
%phase
dy(4)=unwrap(angle(y(1)));
call function:
clc
clear all
close all
TSPAN = [0 5];
Y0 =[0 0 0 0];
[T,Y] = ODE45(@rate_equation3,TSPAN,Y0);
figure(1)
subplot(2,1,1)
plot(T ,Y(:,1))
title('plot of ')
subplot(2,1,2)
plot(T,Y(:,2))
title('plot of ')
figure(2)
subplot(2,1,1)
plot(T ,Y(:,3))
tittle('plot')
subplot(2,1,2)
plot(T ,Y(:,4))
tittle('plot')
function:
function [dy] = rate_equation3(t,y)
dy = zeros(4,1);
Gn = 2.2e-19;
gcf=5.2e-20; %gcf=gain compression factor
cff=0.746; %confinement factor
alpha=6.5; %linewidth enhancemnet factor
q = 1.6e-19; % electron charge
v = 3.75e-14; % modal volume
I = 2.5; %constant input current
tua_p = 2.05e-12; %photo life time
tua_e = 0.126e-9; %carrier life time
N0 = 3.0e21; %carrier density at transparency
g = Gn*(y(2)-N0)*(1-gcf*y(3)); %nonliear gain expression
%E(t)
dy(1)=0.5*(cff*g-1/tua_p)*y(1)+i*alpha/2*(cff*gcf*(y(2)-N0)-tua_p)*y(1);
%N(t)
dy(2)=I/(q*v)-y(2)/tua_e-g*y(3);
%S(t)
dy(3)=abs(y(1).^2);
%phase
dy(4)=unwrap(angle(y(1)));
call function:
clc
clear all
close all
TSPAN = [0 5];
Y0 =[0 0 0 0];
[T,Y] = ODE45(@rate_equation3,TSPAN,Y0);
figure(1)
subplot(2,1,1)
plot(T ,Y(:,1))
title('plot of ')
subplot(2,1,2)
plot(T,Y(:,2))
title('plot of ')
figure(2)
subplot(2,1,1)
plot(T ,Y(:,3))
tittle('plot')
subplot(2,1,2)
plot(T ,Y(:,4))
tittle('plot')