'rotating' matrix data around one point
显示 更早的评论
Hi everyone,
I am having the following matrix:
-0.0052 -0.0113 -0.0178 -0.0157 -0.0053 0.0033 0.0073 0.0080 0.0071
-0.0032 -0.0152 -0.0433 -0.0370 -0.0014 0.0144 0.0173 0.0150 0.0114
0.0062 0.0026 -0.1158 -0.0565 0.0423 0.0467 0.0380 0.0267 0.0173
0.0205 0.0551 0.2696 0.3313 0.1654 0.1145 0.0758 0.0435 0.0237
0.0268 0.0611 0.1415 0.2187 0.2313 0.2187 0.1415 0.0611 0.0268
0.0237 0.0435 0.0758 0.1145 0.1654 0.3313 *0.2696* 0.0551 0.0205
0.0173 0.0267 0.0380 0.0467 0.0423 -0.0565 *-0.1158* 0.0026 0.0062
0.0114 0.0150 0.0173 0.0144 -0.0014 -0.0370 -0.0433 -0.0152 -0.0032
0.0071 0.0080 0.0073 0.0033 -0.0053 -0.0157 -0.0178 -0.0113 -0.0052
Now I want the data to 'move' around one of the 'points' in the matrix, namely the one between the marked points (0.2696 and -0.01158). So I want to -0.0433 point to be in the place of the -0.0370 point and the -0.0370 point one the place of the -0.0565 point and so on. I have no idea how to do this. Hopefully one of you will know.
Thanks in advance
采纳的回答
更多回答(1 个)
Jos (10584)
2014-3-17
You can use CIRCSHIFT to move the a point to the centre of the matrix, and then apply ROT90 to rotate it, and apply CIRCSHIFT again.
M1 = magic(5)
rotpos = [0 1] % position of rotation point
M2 = circshift(M1,-rotpos)
M3 = rot90(M2)
M4 = circshift(M3, rotpos)
I am not sure if this is what you're really after though ...
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!