title: Explanation of the Matlab coding
body: <p>I found this Matlab code on the internet. Its actually a part of the whole code which can be found <a href="http://cnx.org/content/m14196/latest/timeout.m" rel="nofollow">here</a>. Can someone explain line by line what's happening. Im really desperate... </p>
  
  <pre><code>% ------------- % This is code to make the edge detecting filter % ----%
  function filter=gaussfilt(N)
  
  % calculate alpha so the filter fills all N points
  alpha=N;
  first=-(1-N/2)*exp(-(1-N/2)^2/alpha);
  count=0;
  while first&lt;.1*(-(1530/4000*N-N/2)*exp(-(1530/4000*N-N/2)^2/alpha))
      count=count+1;
      alpha=N*500*count;
      first=-(1-N/2)*exp(-(1-N/2)^2/alpha);
  end
  
  for n=1:N
       filter(n)=-(n-N/2)*exp(-(n-N/2)^2/alpha);   % d/dt of a gaussian
  end
  filter=filter/sum(abs(filter));     % normalization
  
  return
  </code></pre>