Build a rotation matrix . makehgtform can be useful for that. Then construct
[X(:), Y(:), zeroes(numel(X),2)]
and right multiply by the transform matrix . X and Y are the coordinates of the points on the circle . Discard the 4th column of the results of the multiply and what remains is columns of X Y Z coordinates .