How can I specify a summation constraint?

Hi, I have this matrix
P =
[ 0, 1/5, p13, p14, p15]
[ 0, 0, p23, p24, p25]
[ 0, 0, 0, p34, p35]
[ 0, 0, 0, 0, p45]
[ 0, 0, 0, 0, 0]
These are the probabilities and I've defined them as symbolic variables. I want to give a constraint that says that the sum of each row is equal to 1. Can someone direct me on how I can get started or what I need to look at?
Thanks,
Burak

Answers (1)

syms p13 p14 p15 p23 p24 p25 p34 p35 p45 
P =[ 0, 1/5, p13, p14, p15
  0, 0, p23, p24, p25
  0, 0, 0, p34, p35
  0, 0, 0, 0, p45
  0, 0, 0, 0, 0]
isequal(sum(P,2),ones(size(P,1),1))

Categories

Asked:

on 12 Apr 2016

Answered:

on 12 Apr 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!