我有一个有5个节点的定向未加权图:x1到x5。边缘是:
x1->x3
x2->x1
x2->x5
x3->x2
x3->x4
x4->x5
x5->x2
我想解决与图表对应的这组方程式:
x1 = alpha * x2
x2 = alpha * (x3 + x5)
x3 = alpha * x1
x4 = alpha * x3
x5 = alpha * (x2 + x4)
x1 + x2 + x3 + x4 + x5 = 1
如何在Matlab中设置这些方程并求解?我想要方程所适用的x1到x5的值。
答案 0 :(得分:0)
以下是适合我的解决方案:
syms a b c d e alpha
S = solve(-a+alpha*b==0, -b+alpha*c+alpha*d==0, alpha*a-c==0, alpha*c-d==0, ...
alpha*d-e==0, a+b+c+d+e==1);
S = [S.a S.b S.c S.d S.e S.alpha]