Given a 2D distribution. See image:
),How can I find the Region of Interest that contains 90% or开发者_开发技巧 95% of the data in matlab?
Many thanks
Use error_ellipse
to obtain the required confidence region. All you need to do is give it the covariance matrix (easily obtained with cov(D)
where D
is matrix where each row is a mean-shifted point)
Sample code:
D = randn(1000,2);
mu = mean(D);
Dm = bsxfun(@minus,D,mu);
error_ellipse(cov(Dm),'conf',0.95,'mu',mu);
hold on;
plot(D(:,1),D(:,2),'r*');
精彩评论