A matrix of rank 1 can be created by the outer product of two vectors, for example:
A = randn(10,1) * randn(1,10);
Add together k of these and you will have a matrix of rank k. Like this:
>> A = zeros(10);
>> for i = 1:4, A = A + randn(10,1) * randn(1,10); end
>> rank(A)
ans = 4