Can I rotate an array by 15 degrees?.
19 views (last 30 days)
Show older comments
Can I rotate an array by 15 degrees?. Thanks
1 Comment
Stephen23
on 25 Sep 2017
Once you define for us what that means, then yes. Please show what this matrix looks like once it has been rotated by fifteen degrees:
>> [0,1;1,0]
ans =
0 1
1 0
Answers (2)
Bjorn Gustavsson
on 25 Sep 2017
As Stephen points out you need to specify matters a bit more. Primarily what rotate by 15 degrees would mean for arrays in dimensions larger than 2.
For the 2-D case this should do it:
rotM = @(phi) [cos(phi) -sin(phi);sin(phi) cos(phi)]; rot15_a = rotM(15*pi/180)*a;
I have seen people using other notations for the rotation angle...
HTH
3 Comments
Bjorn Gustavsson
on 25 Sep 2017
Edited: Bjorn Gustavsson
on 25 Sep 2017
Yes, I thought that reasonably obvious?
Walter Roberson
on 25 Sep 2017
Coordinates are more often given with the x and y as columns rather than as rows.
If the reader was thinking in terms of rotating images rather than in terms of applying rotation to coordinate matrices, then they might not immediately recognize that the rotM code is not directly suitable for rotating images.
Walter Roberson
on 25 Sep 2017
Sometimes imrotate() is what is needed.
But only sometimes.
0 Comments
See Also
Categories
Find more on Array Geometries and Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!