title: Matlab---can pdepe solve 1st order pde set like this?
body: <p><em>Equation：</em></p>
  
  <p>variable: z, t</p>
  
  <p>want: S = S(z,t), A = A(z,t)</p>
  
  <p>parameter: a,b,c</p>
  
  <p>i is sqrt(-1)</p>
  
  <p>d is the partial derivative operator</p>
  
  <p><strong>dS/dt = -i*a*z*S - i*b*A</strong></p>
  
  <p><strong>(d/dz +c*d/dt)A = -i*S</strong></p>
  
  <p><em>Boundary condition:</em></p>
  
  <p>sigma is the pulse width</p>
  
  <p>tm is center of the pulse</p>
  
  <p>at z = 0,</p>
  
  <p>A(1,t) = (0.398942/sigma)*exp(-((t-tm).^2)/(2*sigma^2)) (Gaussian pulse)</p>
  
  <p>at z  = 1,
  boundary condition is not clear. Expected to be near 0. If I use Mathematica, then it is not necessary to specify this boundary condition. Actually this boundary is the aim of solving this pde.</p>
  
  <p><em>Initial condition:</em></p>
  
  <p>at t = 0,</p>
  
  <p>S = 0</p>
  
  <p>A = 0(near 0. It should be the rim of the above Gaussian pulse)</p>
  
  <p>I was trying to solve this pde set with pdepe. The result shows:</p>
  
  <p>??? Error using ==> daeic12 at 77
  This DAE appears to be of index greater than 1.</p>
  
  <p><strong>My question is: can pdepe solve peds like these?</strong></p>
  
  <p>×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××</p>
  
  <p>Details: change the equation into the form of:</p>
  
  <p>[1; c].* d/dt [S; A] = d/dz [0; -A] + [-i*a*z*S-i*b*A; -i*S]</p>
  
  <p>Then my code for equation: (parameter name is changed, not long called a, b and c)</p>
  
  <pre><code>function [ c,f,s ] = myPdeNoDecay( z,t,u,dudz)
  LoverzetacT = 6.712414322355693e-05;
  betaLT = 66.713366022882500;
  omegayetaksbarLT = 4.183966095613130e+02;
  
  c = [1;LoverzetacT];
  f = [0;-u(2)];
  s = -1i*[betaLT.*z.*u(1)+omegayetaksbarLT.*u(2);u(1)];
  end
  </code></pre>
  
  <p>Boundary condition:</p>
  
  <pre><code>function [ pl,ql,pr,qr ] = myPdeNoDecayBC( xl,ul,xr,ur,t )
  tm = 0.5; %ns, Normalized central time of the pulse
  sigma = 0.1; %ns, Normalized width of the pulse, 10^-7s
  
  pl = [ul(2)-iniShape(t,sigma,tm);0];
  ql = [0;0];
  pr = [0;0];
  qr = [0;0];
  end
  
  function [G] = iniShape(t,sigma,tm)
  G = (0.398942/sigma)*exp(-((t-tm).^2)/(2*sigma^2));
  end
  </code></pre>
  
  <p>Initial condition:</p>
  
  <pre><code>function [ u0 ] = myPdeNoDecayIC( x )
  u0 = [0;0];
  end
  </code></pre>
  
  <p>main function:</p>
  
  <pre><code>clear
  close all
  tlist = 0:0.05:1;
  zlist = 0:0.05:1;
  
  LoverzetacT = 6.712414322355693e-05;
  betaLT = 66.713366022882500;
  omegayetaksbarLT = 4.183966095613130e+02;
  
  tm = 0.5; %ns, Normalized central time of the pulse
  sigma = 0.1; %ns, Normalized width of the pulse, 10^-7s
  
  m = 0;
  sol = pdepe(m,@myPdeNoDecay,@myPdeNoDecayIC,@myPdeNoDecayBC,zlist,tlist);
  figure('numbertitle','off','name','my PDE with no decay or two-ph detuning')
  subplot(211);
  surf(zlist,tlist,sol(:,:,1));
  title('The solution of S');
  xlabel('z');
  ylabel('t');
  zlabel('S(z,t)');
  title('The solution of a');
  xlabel('z');
  ylabel('t');
  zlabel('a(z,t)');
  </code></pre>
  
  <p>error is:</p>
  
  <p>??? Error using ==> daeic12 at 77</p>
  
  <p>This DAE appears to be of index greater than 1.</p>