Rotating X and Y coordinates with a certain angle.

Hello,
I have a 7162176x2 array of cells that represent Cartesian coordinates. Column 1 is X, Column 2 is Y. I am trying to rotate these coordinates by 10 degrees clockwise.
I have read through matrix rotation, vector rotation and point rotation and from what I gather I need to create a rotation matrix and then multiply all my sets of points with it. This is what I have concluded to work with (I am including the before and after steps to make it easier to understand):
clear all
% SORT EXPORT IN THE SAME MANNER AS A .PRM FILE
m=csvread('file.csv',1,0); %REMOVE HEADER
%---------------------------------
%ORDER COLUMNS
n=m(1:end,[7 8 9 1]); %PICK DESIRED CELLS TO USE FOR OUTPUT
coordT=n(1:end,[1 2]); %GET X AND Y TO ROTATE
%ROTATION
theta=-10; %TO ROTATE CLOCKWISE BY X DEGREES
R=[cosd(theta) -sind(theta); sind(theta) cosd(theta)]; %CREATE THE MATRIX
rotcoord=R*coordT; %MULTIPLY VECTORS BY THE ROT MATRIX
%REPLACE X and Y columns on n with rotcoord X and Y
However it seems that the dimensions don't match. Am I approaching this the right way?
Apologies if this is something very simple that I am missing,
Thank you,
Pavlos

 採用された回答

Bruno Luong
Bruno Luong 2018 年 11 月 27 日

0 投票

rotcoord=coordT*R'

1 件のコメント

Pavlos Farangitakis
Pavlos Farangitakis 2018 年 11 月 27 日
Thank you very much! It seems to be working just fine with this!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

リリース

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by