Covariance Matrix Rotation

13 ビュー (過去 30 日間)
Umit
Umit 2012 年 5 月 14 日
コメント済み: Jim 2014 年 4 月 2 日
Hi, I have a matrix 3 by 3 and I want to rotate it with theta and phi angles (result of spherical coordinates), counterclockwise. I have the following function;
function [NewMatrix] = SphericalRotation(Matrix, theta, phi, ScaleRatio)
M1 = [cos(theta) -sin(theta) 0; sin(theta) cos(theta) 0; 0 0 1];
M2 = [1 0 0; 0 cos(phi) -sin(phi); 0 sin(phi) cos(phi)];
NewMatrix = ScaleRatio^0 * M2 * M1 * Matrix * M1' * M2';
end
When;
Matrix = [4 0 0; 0 4 0; 0 0 4],
theta = 0.78,
phi=0.61,
scaleRatio= 1.2 (Not important, results 1 always right now),
I get
NewMatrix=[4 0 0; 0 4 0; 0 0 4]
I don't think this is correct, I should get something different, it is not rotated at all. I believe I am missing sth. very basic. Any help greatly appreciated. Thanks
  3 件のコメント
Umit
Umit 2012 年 5 月 14 日
I matrices, I believe it has to be in this way, for vectors it is just M2*M1*Vector
Jim
Jim 2014 年 4 月 2 日
Your test matrix Matrix represents a spherical probability distribution, i.e., the principal values are all identical. There's no way to orient a sphere, which is why your function returns an unaltered output. Try setting Matrix = [10 0 0; 0 3 0; 0 0 1] and you'll see a difference in the output.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by