📄 test_rand_special_orthogonal.m
字号:
% Tests the random special orthogonal matrix function.n = 10;X = rand_special_orthogonal(n);% Test that all rows and columns have unity magnitude.for col = 1:10, if abs(norm(X(:,col))-1) > .000001, error('Found column of non-unity norm') end if abs(norm(X(col,:))-1) > .000001, error('Found row of non-unity norm') endend% Check that the determinant of the matrix is unityif abs(det(X)-1) > .0001, error('Matrix does not have unity determinant')end% Check distribution by taking a random vector and seeing where a bunch of% X's take it.n = 2;x = randn(n,1);numpoints = 500;XX = zeros(n,numpoints);for k = 1:numpoints, X=rand_special_orthogonal(n); xx = X*x; XX(:,k) = xx;endif n==2, plot(XX(1,:),XX(2,:),'ro')endif n==3,plot3(XX(1,:),XX(2,:),XX(3,:),'ro')end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -