【问题标题】:Plotting a curve on probability simplex在概率单纯形上绘制曲线
【发布时间】:2014-08-26 11:24:24
【问题描述】:

我想绘制由给出的概率向量的参数曲线 (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])

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

【问题讨论】:

    标签: matlab plot


    【解决方案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) + vector(v)*scalar(t) 定义了一条线。

    【讨论】:

      猜你喜欢
      • 2021-08-17
      • 2023-03-31
      • 2015-11-24
      • 2013-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-20
      • 1970-01-01
      相关资源
      最近更新 更多