title: Matlab image translation matrix
body: <p>I'm very new to Matlab. I'm learning some image manipulation basics, and I'm a bit confused on how to write a translation <em>without using imtranslate</em>.</p>
  
  <p>this is my code but it just displays a black background. Thank you.</p>
  
  <pre><code>img = imread('name2.png');
  figure(1);
  
  % pixel matrix
  [orig_x, orig_y,z] = size(img); 
  
  final_x = 600;                      
  final_y = 600;                     
  
  % define the final array with calculated dimensions and fill the array with zeros ie.,black
  final_img = uint8(zeros([final_x final_y 3 ]));
  
  for i = 1 : size(final_img, 1)
      for j = 1 : size(final_img, 2)        
            new_x = img(i) + 5;
            new_y = img(j) + 5;
  
           % fprintf('X: %f\n',new_x); % prints 255
  
          final_img(i) = new_x;
          final_img(j) = new_y;
  
      end
  end
  
  imshow(final_img);
  </code></pre>