How to rotate the field vectors in the minimum covariance direction?

3 次查看(过去 30 天)
I have a magnetic field data (n by 3 components) and i wish to find its covariance matrix and obtain eigen values, eigen vectors.
Now how to rotate this magnetic field vectors in the minimum covariance direction?
I attempted the following steps to obtain eigen values and eigen vectors:
Bxyz is nX3 matrix.
covx = cov(Bxyz(:,:));
[ei_vec,ei_val,explained] = pcacov(covx);
[min_eival id_min_eival] = min(ei_val);
MVDir = ei_vec(id_min_eival,:);

回答(1 个)

Shashank Gupta
Shashank Gupta 2020-10-22
Hi Megha,
I am assuming the minimum covariance direction here means the direction in which the spread(variance) of data is least. I am not really sure why do you want to rotate, may be you want to project the data in that direction (that would make sense), not the rotatation as such. For now let's just assume you want to project the magentic field data in the min covariance direction, You already found the least eigen value and the corresponding eigen vector, Now you simple need to project that data, you can do so,
BxyzTransformed = MVDir'*Bxyz
And even you can find the transformed covariance matrix by,
covxTransformed = MVDir'*covx*MVDir
I hope, I understood your question properly or atleast the intention.
Cheers

类别

Help CenterFile Exchange 中查找有关 Cartesian Coordinate System Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by