title: First Derivative filter Matlab
body: <p>I have recently been tasked with using a first derivative filter on an image of myself. The instructor said that I should first fix the value of y and preform f(x+1) - f(x) on the rows and then fix the new "X" values and preform f(y+1)-f(y) on the columns.</p>
  
  <p>Note: I have been asked to do this task manually, not using filter2() or any other programmed function, so please do not suggest that I use filter2() or similar. Thanks!</p>
  
  <p>I tried calling up all the pixels and subtracting each successive one by doing</p>
  
  <pre><code>fid = fopen('image.raw')
  myimage = fread(fid,[512 683], '*int8')
  fclose(fid)
  
  imsz = size(myimage)
  
  x = imsz(1)
  
  for I = 1:512
  for J = 1:683
  
  X(I) - X(I-1) = XX
  </code></pre>
  
  <p>But it doesnt seem to work, and I dont quite understand why. If you could help me, or point me in the right direction, I would be very appreciative. </p>