# how to rotate a matrix 5x4 by 45° around the origin (0,0) ?

7 ビュー (過去 30 日間)
Makrim 2015 年 5 月 16 日
コメント済み: Walter Roberson 2015 年 5 月 16 日
Suppose I have a matrix M of 5x4 dimension (this is represent an image) :
M =[3 4 8 9;
1 6 7 3;
9 8 3 1;
1 2 2 0;
7 2 3 5];
I would like to rotate it around the origin (0,0) with an angle of 45°.
From what I have found on the net , I have to multiply M by Rotation Matrix R is as follow :
R = [ cosd(45) -sind(45);
sind(45) cosd(45)]
Now do I simply multiply M by R and get a rotated matrix ??? like this :
rotM = R*M
I think I will have a problem of dimensions ? please how to rotate a matrix 5x4 by 45° around the origin (0,0)?
PS: imrotate, rot90, flip* and rotate is not suitable here, thank you in advance.
##### 2 件のコメント表示非表示 1 件の古いコメント
Image Analyst 2015 年 5 月 16 日
Where is your pivot point (center of rotation)? Which of those elements in your example, or where in between the elements or outside of them, do you call the (0,0) location?

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

### 回答 (1 件)

Walter Roberson 2015 年 5 月 16 日
Use matrix multiplication, the * operator, not the .* operator.
Remember that in MATLAB, sin() and cos() take radians as the argument, not degrees. You can use sind() and cosd() for degrees.
##### 2 件のコメント表示非表示 1 件の古いコメント
Walter Roberson 2015 年 5 月 16 日

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

### カテゴリ

Find more on ROI-Based Processing in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by