I want to generate a matrix of random numbers (normrnd with mean == 0) that satisfy the following constraints using MATLAB (or any other language)
- The sum of the absolute values in the matrix must equal
X - The largest
abs(single number)must equalY - The difference between the number and its 8 neighbors (3 if in corner, 5 if on edge) must be less than
Z
It would be relatively easy to satisfy one of the constraints, but I can't think of an algorithm that satisfies all of them...
Any ideas?
A very simply 3 x 3 where 5 is the max element value, 30 is the sum, and 2 is the difference
5 4 3
4 4 2
3 2 3
The last constraint may necessarily have to operate on the generated distribution, making it...not really gaussian
– Tim Mar 17 '14 at 16:40