Hello,
I have a 257×257 X,Y coordinate meshgrid that I need to rotate by 10 degrees (counterclockwise) and then move it along the x and y axis by adding a certain number to it (175.5362) in order to move it to the right location. This is what I have so far:
%Create the meshgrid
Xinit = 0:3125:800000;Yinit = 0:3125:800000;[Xq,Yq] = meshgrid(Xinit,Yinit);
When doing it in vector arrays I would do this:
theta=-10; %TO ROTATE CLOCKWISE BY X DEGREES
R=[cosd(theta) -sind(theta); sind(theta) cosd(theta)]; %CREATE THE MATRIX
rotXY=XY*R'; %MULTIPLY VECTORS BY THE ROT MATRIX
But this is a 257×257 matrix and I get this subsequently:
"Error using *
Inner matrix dimensions must agree."
I assume the second part of my question is just a matter of doing this:
%SHIFTING
Xq=Xq+175.5362;Yq=Yq+175.5362;
Apologies if this is something very simple that I am missing again,
Thank you,
Pavlos
Best Answer