Created
July 29, 2014 07:21
-
-
Save ozymandium/b3e59dda97d7c9119418 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all; close all; clc | |
x = randn(2,3); | |
PN = cov(x'); % covariance in the navigation frame | |
error_ellipse(PN,'style','b'); | |
axis equal; | |
hold on; | |
grid on; | |
stdx = sqrt(PN(1,1)); | |
stdy = sqrt(PN(2,2)); | |
%rho = PN(1,2) / (stdx*stdy) | |
[E,D] = eig(PN); | |
alpha_x = atan2(E(2,2),E(1,2)) | |
alpha_y = atan2(E(2,1),E(1,1)) | |
Cx = rot2z(-alpha_x); | |
Cy = rot2z(-alpha_y); | |
PPx = Cx*PN*Cx'; | |
PPy = Cy*PN*Cy'; | |
error_ellipse(PPx,'style','g') | |
error_ellipse(PPy,'style','r') | |
legend('original','rotated x','rotated y') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment