Clear Filters
Clear Filters

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

3 views (last 30 days)
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,:);

Answers (1)

Shashank Gupta
Shashank Gupta on 22 Oct 2020
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

Categories

Find more on Descriptive Statistics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!