搜索内容 搜索用户

# [未答复] matlab程序直流换成方波怎么换？

hexidesisisi 发表于 2019-1-10 12:46:56
 大家好，我目前用ode45对激光速率方程式进行仿真。 但是电流 I 目前用的常数，想要把这个常数换成输入一个有周期的方波，请问怎么改？ 我自己尝试了几次都没有成功 谢谢 LL=[300E-6]; ww=[5E-6]; dd=[0.2E-6]; for iii=1:length(LL)     ti = 0;     tf = 2E-9;     tspan=[ti tf];     y0=[0; 0; 0];       V=LL(iii)*ww(iii)*dd(iii);     [T,Y]= ode45(@(t,y) rate_eq(t,y,V),tspan,y0);     figure(1);     hold on     subplot(2,1,1);     plot(T,Y(:,1));     title('carrier density');     xlabel('time');     ylabel('carrier');     subplot(2,1,2);     plot(T,Y(:,2));     title('photon density');     xlabel('time');     ylabel('photon');     hold off end function dy = rate_eq(t,y,V) LL=250E-6; dy = zeros(3,1); % d = active layer thickness  [meters] %d = 2E-7; I=3; % te = electron lifetime[seconds] te = 2.2E-9; % tp = photon lifetime tp = 1.6E-12; % BuyukGama = optical confinement factor BuyukGama = 0.3; % a = linewidth broadening factor[GAIN CONSTANT][cm^2 -- m^2] a = 2.5E-20; % Betasp = malzemenin spontane emisyon faktoru Betasp=10^-3; % B= radiatif rekombinasyon sabiti[CM^3/S -- m^3/s] B=10E-16; % c =velocity of light[m/s] c=3*10^8; % e = electron charge e = 1.602E-19; %ug= grup reflecive index ug=4; % n0 = carier density at transparancy[cm^-3 -- m^-3 ] n0 = 1E24; % V = volume[m^3] %V=d*5E-6*250E-6; % h = Planck Constant h = 6.626074E-34; % vg=grup velecity[vg= c/ug] vg= c/ug; % am= resonator loss [cm^-1 -- m^-1] am=45E2; % nuu = frequancy nuu =(c/1300E-9); % Ey(1): carier population % y(2): photon population % rate equation for carrier density % Carriers dy(1) = (I/e) - y(1)/te - (BuyukGama*c*a*(y(1)/V-n0)/ug)*y(2); % Photons dy(2) = (BuyukGama*c*a*(y(1)/V-n0)/ug)*y(2)- y(2)/tp + Betasp*B*y(1)^2/V +19*10^4/1.6E-12; dy(3) = h*nuu*vg*am*dy(2)/2;% end
 您需要登录后才可以回帖 登录 | 注册 本版积分规则 回帖后跳转到最后一页