function f = linspacepixels(x1,x2,n) <x1>,<x2> are numbers <n> is the number of desired points return a vector of equally spaced points that can be treated as centers of pixels whose total field-of-view would be bounded by <x1> and <x2>. example: isequal(linspacepixels(0,1,2),[.25 .75])
0001 function f = linspacepixels(x1,x2,n) 0002 0003 % function f = linspacepixels(x1,x2,n) 0004 % 0005 % <x1>,<x2> are numbers 0006 % <n> is the number of desired points 0007 % 0008 % return a vector of equally spaced points that can 0009 % be treated as centers of pixels whose total field-of-view 0010 % would be bounded by <x1> and <x2>. 0011 % 0012 % example: 0013 % isequal(linspacepixels(0,1,2),[.25 .75]) 0014 0015 dif = ((x2-x1)/n)/2; % half the difference between successive points 0016 f = linspace(x1+dif,x2-dif,n);