绘制概率单形的曲线

时间:2014-08-26 11:24:24

标签: matlab plot

我想绘制由

给出的概率向量的参数曲线(p_1,p_2,p_3)
  

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

使得p_1,p_2,p_3> = 0(注意方程已经满足p_1 + p_2 + p_3 = 1)对概率单纯形{{p_1,p_2,p_3):p_1,p_2,p_3> = 0和p_1 + p_2 + p_3 = 1}。

我希望将其视为2D图,即单面平面中的曲线。有没有办法在matlab中做到这一点?有人可以帮忙吗?

我使用了3D情节

  

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

但这并没有让我对曲线有个好主意。

1 个答案:

答案 0 :(得分:1)

这是我在MATLAB中绘制它的方式,如果它是一条曲线:

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);

据我所知,你有一条线虽然常数(1/3)+矢量(v)*标量(t)定义了一条线。

相关问题