title: Solving for Fisher Kolmagorov Partial Differential Equation
body: <p>I have been trying to solve the non dimensional Fisher Kolmagorov equation in Matlab. I am getting a graph which doesn't look at all like it should. Also, I'm getting the equation independent of value of <code>s</code> (the source term in the <code>pdepe</code> solver). No matter what value of <code>s</code> I put in the graph remains the same.</p>
  
  <pre><code>function FK     
  m = 0;    
  x = linspace(0,1,100);    
  t = linspace(0,1,100);    
  u = pdepe(m,@FKpde,@FKic,@FKbc,x,t);    
  [X,T] = meshgrid(x,t);
  
  %ANALYTICAL SOLUTION    
  % a=(sqrt(2))-1;    
  % q=2;    
  % s=2/q;    
  % b= q /((2*(q+2))^0.5);    
  % c= (q+4)/((2*(q+2))^0.5);    
  % zeta= X-c*T;    
  %y = 1/((1+(a*(exp(b*zeta))))^s);    
  %r=(y(:,:)-u(:,:))./y(:,:); % relative error in numerical and analytical value
  
  figure;    
  plot(x,u(10,:),'o',x,u(40,:),'o',x,u(60,:),'o',x,u(end,:),'o')    
  title('Numerical Solutions at different times');    
  legend('tn=1','tn=5','tn=30','tn=10','ta=20','ta=600','ta=800','ta=1000',0);    
  xlabel('Distance x');
  ylabel('u(x,t)');    
  
  % --------------------------------------------------------------------------
  function [c,f,s] = FKpde(x,t,u,DuDx)    
  c = 1;    
  f = DuDx;    
  s =u*(1-u);
  
  % --------------------------------------------------------------------------    
  function u0 = FKic(x)    
  u0 = 10^(-4);
  
  % --------------------------------------------------------------------------    
  function [pl,ql,pr,qr] = FKbc(xl,ul,xr,ur,t)    
  pl = ul-1;    
  ql = 0;    
  pr = ur;    
  qr = 0;
  </code></pre>