edwin
edwin

Reputation: 113

Plotting a curve on probability simplex

I would like plot the parametric curve (p_1,p_2,p_3) of probability vectors given by

p_1 = 1/3 + (10/3)t, p_2 = 1/3 - (2/3)t, and p_3 = 1/3 - (8/3)t

such that p_1, p_2, p_3 >= 0 (note that the equations already satisfy p_1 + p_2 + p_3 = 1) on the probability simplex {(p_1,p_2,p_3) : p_1, p_2, p_3 >= 0 and p_1 + p_2 + p_3 = 1}.

I would like to see this as a 2D plot, i.e., a curve in the simplex plane. Is there a way to do this in matlab? Can someone help?

I used the 3D plot

ezplot3('1/3+10/3*t','1/3-2/3*t','1/3-8/3*t',[-5,1/8])

But this doesn't give me a good idea about the curve.

Upvotes: 1

Views: 1426

Answers (1)

mikesapi
mikesapi

Reputation: 223

This is how I would plot it in MATLAB, if it were a curve :

clf, clc, clear all

%% First lets draw a 2-simplex (three vertices). 
line_width = 2; 
k=2; %2-simplex
simplex_vertices = eye(k+1);

%% for plotting
figure(1), clf,
simp_vert = [simplex_vertices, simplex_vertices(:,1)];
plot3(simp_vert(1,:),simp_vert(2,:),simp_vert(3,:));
hold on

%% Now let s generate t within some range
t = -0.1:0.001:0.1;
x1 = (1/3) + (10/3).*t;
x2 = (1/3) - (2/3)*t;
x3 = (1/3) - (8/3)*t;

%check: sum(x) is equal to 1


%% Plotting
plot3(x1, x2, x3, 'go', 'LineWidth',line_width);

As I understand it, you have a line though.. constant(1/3) + vector(v)*scalar(t) defines a line.

Upvotes: 1

Related Questions