Home > analyzePRF > utilities > calcunitcoordinates.m

calcunitcoordinates

PURPOSE ^

function [xx,yy] = calcunitcoordinates(res)

SYNOPSIS ^

function [xx,yy] = calcunitcoordinates(res)

DESCRIPTION ^

 function [xx,yy] = calcunitcoordinates(res)

 <res> is the number of pixels on a side
  
 return <xx> and <yy> which contain x- and y-coordinates corresponding
 to equally spaced points within the space bounded by -.5 and .5.
 these points can be treated as centers of pixels.

 example:
 [xx,yy] = calcunitcoordinates(2);
 isequal(xx,[-.25 .25; -.25 .25]) & isequal(yy,[.25 .25; -.25 -.25])

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [xx,yy] = calcunitcoordinates(res)
0002 
0003 % function [xx,yy] = calcunitcoordinates(res)
0004 %
0005 % <res> is the number of pixels on a side
0006 %
0007 % return <xx> and <yy> which contain x- and y-coordinates corresponding
0008 % to equally spaced points within the space bounded by -.5 and .5.
0009 % these points can be treated as centers of pixels.
0010 %
0011 % example:
0012 % [xx,yy] = calcunitcoordinates(2);
0013 % isequal(xx,[-.25 .25; -.25 .25]) & isequal(yy,[.25 .25; -.25 -.25])
0014 
0015 % notice that the second argument proceeds from .5 to -.5.
0016 % this ensures that the results match the usual coordinate axes
0017 % where the top is the positive y-axis.
0018 [xx,yy] = meshgrid(linspacepixels(-.5,.5,res),linspacepixels(.5,-.5,res));

Generated on Wed 18-Jun-2014 21:47:41 by m2html © 2005