linspacepixels.m 451 B

12345678910111213141516
  1. function f = linspacepixels(x1,x2,n)
  2. % function f = linspacepixels(x1,x2,n)
  3. %
  4. % <x1>,<x2> are numbers
  5. % <n> is the number of desired points
  6. %
  7. % return a vector of equally spaced points that can
  8. % be treated as centers of pixels whose total field-of-view
  9. % would be bounded by <x1> and <x2>.
  10. %
  11. % example:
  12. % isequal(linspacepixels(0,1,2),[.25 .75])
  13. dif = ((x2-x1)/n)/2; % half the difference between successive points
  14. f = linspace(x1+dif,x2-dif,n);