Ive got a meshgrid in 2d that i've been rotating so far. I want toe expand the mesh to 3d, and am having some trouble rotating it. This is how i've been doing it for 2D:
xLin = linspace(-10*scale/4,10*scale/4,200);
yLin = linspace(-10*scale/4,10*scale/4,200);
[x,y] = meshgrid(xLin,yLin); % create mesh
angle1 = -1*atan2(k1(1,2),k1(1,1));
XY1 = [x(:) y(:)];
R1=[cos(angle1) -sin(angle1); sin(angle1) cos(angle1)];
rotXY1=XY1*R1';
Xr1 = reshape(rotXY1(:,1), size(x,1), []);
Yr1 = reshape(rotXY1(:,2), size(y,1), []);
Best Answer