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

조회 수: 1 (최근 30일)
Megha 2020년 10월 13일
답변: Shashank Gupta 2020년 10월 22일
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 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에서 Descriptive Statistics에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by