function dE_dz =asim(z,E1,~,~) c=3*1e8;L=800*10^-9pi=3.1415926535;Dk=20.94;w1=(2*pi*c)/L;%w1=fs*[-N/2:N/2-1];
deff=2.0657e-12;Lc=2*pi/Dk;Lnl=50*Lc;n2=5*10^-16;I0=10^-9; dE_dz = (-1i*conj(E1).*E1.^2.*w1*deff)/(c*n2*Dk)+ 1i*2*pi*(n2*I0)*(Lnl/L)*((abs(E1)).^2).*E1 +... + 1i*4*pi*(n2*I0)*(Lnl/L).*((-w1*deff.*E1.^2*exp(-1i*Dk*z))/(c*n2*Dk)).^2.*E1; end clc; clear all; close all; clf; Pi=1.98; %input('Enter the value of input power in mW ')
t=120*10^-15 %input('Enter the value of input pulse width in seconds ')
tau=-300*10^-15:0.1*10^-15:300*10^-15; %input('Enter time period with upper(U), lower(L) and interval between upper and lower interval(I) in this format L:I:U')
dt=1e-15/tfs=1/dt;pi=3.1415926535;Ao=sqrt(Pi) % amplitude of an input gaussian pulse
h=2000 % small step as defined by split step algorithm
%for ii=0.1:0.1:(s/10) %1*10^-7:1*10^-7:s %different fiber lengths
E1=Ao*exp(-(tau/t).^2); % generation of an gaussian input pulse
figure(1)plot(tau,abs(E1)); % graph of input pulse
title('Input Pulse'); xlabel('Time in ps'); ylabel('Amplitude');grid on;hold on; [z,E1]=ode45(@asim,[0 1.0],0.6325)%q = ode45(@(z,E1)asim(z,E1,~,~),[0 1],E1_0);
% time=
% % % tau1=L*(-300*10^-15:300*10^-15);
plot(z,E1);
MATLAB: The code is entering infinite loop when i am trying to solve differential equation using ode45 command , can some one help me fix this
infinite loop coming while solving using ode45 command.
Related Question
- Getting error for the program as ” Error using * Inner matrix dimensions must agree.” on line 42 . can someone help me resolve this issue
- There is the error that “insufficient number of inputs”
- Getting error as Matrix dimensions must agree.” can someone help me resolve this
- How to run script iteratively
Best Answer