MATLAB: Random matrix with constraints:

matrix arrayrandomvector

Hello, I want to generate a random matrix M * N, with two constraints: 1-the sum of the lines is fixed 2-the sum of the columns is fixed. for exmaple: matrix 6*4, sum of lines = 1 and the sum of the 4 columns respectively: 2.43 1.68 1.53 1.18 thank you in advance

Best Answer

I did not test it, but this code at least promises to do the job:
If you have access to MATHEMATICA, you can use
where the "region" is given by your constraints.
Best wishes
Torsten.