Plot a set of points in a standard simplex
이전 댓글 표시
How do I plot a 2D standard (probability) simplex (just a plot of an equilater triangle) and plot a set of points (probability vectors of size 3) inside the triangle? And how to do the same thing in 3D? I have looked at Matlab documentantion, but could not find a direct way to do it...
채택된 답변
추가 답변 (1개)
For 2D:
p=nsidedpoly(3);
c=rand(10,3); c=c./sum(c,2);
v=num2cell(c*p.Vertices,1); %"probability vectors"
plot(p); axis equal; hold on
scatter(v{:},'filled'); hold off
For 3D, you would do similarly, but you would need scatter3() and you would need to download plotregion().
figure;
plotregion(-[1,1,1],-1,[0,0,0]); view(3);hold on
v=num2cell(c,1);
scatter3(v{:},'filled'); hold off
카테고리
도움말 센터 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



