matlab生成椭圆矩阵,matlab – 椭圆的协方差矩阵

只是通过纯粹的逆向工程(我不再熟悉这种材料),我可以这样做:

%// Generate circle

R = 189;

t = linspace(0, 2*pi, 1000).';

x = R*cos(t);

y = R*sin(t);

%// Find the radius?

[~,L] = eig( cov([x,y]) );

%// ...hmm, seems off by a factor of sqrt(2)

2*sqrt( diag(L) )

%// so it would come out right when I'd include a factor of 1/2 in the sqrt():

2*sqrt( diag(L)/2 )

那么,让我们测试一般省略号的理论:

%// Random radii

a1 = 1000*rand;

a2 = 1000*rand;

%// Random rotation matrix

R = @(a)[

+cos(a) +sin(a);

-sin(a) +cos(a)];

%// Generate pionts on the ellipse

t = linspace(0, 2*pi, 1000).';

xy = [a1*cos(t) a2*sin(t);] * R(rand);

%// Find the deviation from the known radii

%// (taking care of that the ordering may be different)

[~,L] = eig(cov(xy));

min(abs(1-bsxfun(@rdivide, 2*sqrt( diag(L)/2 ), [a1 a2; a2 a1])),[],2)

它总是返回一些可接受的小东西.

所以,似乎工作:)任何人都可以验证这确实是正确的吗?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值