Seeking help creating a double matrix of ones and minus ones
1 view (last 30 days)
I'm relatively new to matlab and I'm trying to create a matrix like the example below. But I can't seem to get the code correct. I've tried the following code neither of which are correct. Would somebody be able to help me out?
ot = ones(N,1);
A = spdiags([-ot -ot],[0 N],N,N*2);
A = sparse(tril(ones(N)));