Plot a set of points in a standard simplex
Mostrar comentarios más antiguos
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...
Respuesta aceptada
Más respuestas (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
Categorías
Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



