I have two matrices Ac and Ep and a parameter k. I need to implement this matrix, which is a function of my prior matrices and k :
ProbEnt(k)[i,j] := if (k < wmax) then binomial(Ac[i,j], k)*Ep[i,j]^k * (1-Ep[i,j])^(Ac[i,j]-k) else 0;
For some reason it will not allow me to define (build) ProbEnt parameter-wise. Is there a way to make this work?
Looks like the function
genmatrixmight work for you. The first argument ofgenmatrixis a function which takes two arguments,iandj, which you can use to define thei, jelement you want.In this case it might be something like
where
mmandnnare the numbers of rows and columns you want.