expand_weights function

Create a weight matrix