-
Notifications
You must be signed in to change notification settings - Fork 1
/
transform_E_theta.m
39 lines (29 loc) · 931 Bytes
/
transform_E_theta.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The function transform_E_theta transforms the values of E and theta
% for given moments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input
% -----
% - theta: array of angle values
% - E: array of energy values
% - thetabar: mean of angle values
% - Ebar: mean of energy values
% - Theta: covariance matrix
% Output
% ------
% - thetastar: array of transformed angle values
% - Estar: array of transformed energy values
% Author: Pablo Seleson
% ------
% Last Modified: February 1, 2022
% -------------
function [thetastar,Estar] = transform_E_theta(theta,E,thetabar,Ebar,Theta)
v = [theta E];
vbar = [thetabar Ebar];
% Compute transformed distribution
w = (sqrtm(Theta))\(v-vbar)';
w = w';
% Assign transformed velocities components
thetastar = w(:,1);
Estar = w(:,2);
end