Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
374 views
in Technique[技术] by (71.8m points)

python - Create covariance matrix using ratio and rotation degree

I am a beginner in Linear Algerbra. I want to create a covariance matrix using given ratio and degree of rotation

For example: If the ratio is 2 and degree of rotation is 45 the covariance matrix should be:

[[2.5, 1.5], [1.5, 2.5]]

I tried this:

R = np.mat([[np.cos(0.785398), -np.sin(0.785398)], [np.sin(0.785398), np.cos(0.785398)]])
S = np.mat([[2, 0], [0, 2]])
np.cov([email protected])

I could not get the desired result.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to rotate and scale the data as Burrito said, then this blog will help. It explains everything you want to do along with the code. covariance-matrix


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...