Given that you have the code below, how do you write a code to count the number of points in each quadrant with the attached data set
1 view (last 30 days)
Show older comments
Classical = pdist2(matrix_logdiff_nsample, mean(matrix_logdiff_nsample),'mahal');
p = size(matrix_logdiff_nsample,2);
chi2quantile = chi2inv(0.99,p);
[SFmcd, MFmcd, Fmcd, OutFmcd] = robustcov(matrix_logdiff_nsample);
plot(Classical, Fmcd, 'o')
line([chi2quantile, chi2quantile], [0, 120], 'color', 'r')
line([0, 80], [chi2quantile, chi2quantile], 'color', 'r')
hold on
plot(Classical(OutFmcd), Fmcd(OutFmcd), 'b*')
xlabel('Mahalanobis Distance')
ylabel('Robust Distance')
title('Distance Plot, Fast MCD method')
2 Comments
Answers (1)
Walter Roberson
on 12 Jul 2020
Supposing your two variables are named v1 and v2, then
counts = accumarray([1+(v1(:)>=mean(v1)), 1+(v2(:)>=mean(v2))], 1, [2 2]);
0 Comments
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!