Given a 2*m-1 by 4*m-3 matrix in which certain elements form a hexagon of side length m, rotate the hexagon 60 degrees counterclockwise, as shown below for m=3:
A=[
'--A-A-A--'
'-B-B-B-B-'
'C-C-C-C-C'
'-D-D-D-D-'
'--E-E-E--']
rot60(A)=[
'--A-B-C--'
'-A-B-C-D-'
'A-B-C-D-E'
'-B-C-D-E-'
'--C-D-E--']
A=rot60(A,n) should rotate the hexagon 60*n degrees counterclockwise (and thus clockwise if n<0).
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers5
Suggested Problems
-
Determine Whether an array is empty
817 Solvers
-
Compute a dot product of two vectors x and y
1057 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
896 Solvers
-
151 Solvers
-
Compute LOG(1+X) in natural log
264 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!