I have a homework assignment where I need to solve something much larger than I am asking, but I am having trouble with how I want to start it off. I need to use the vectors of an Identity Matrix to solve for a matrix A.
I want to create these vectors [1; 0; 0; 0], [0; 1; 0; 0], … as 1 moves down the vector in each one produced. I tried using a FOR loop for this and it did not work. I tried using:
I = zeros(4,1); for k = 1:4 I(k,1) = 1; end
Now, when I do this, it creates [1; 0; 0; 0], [1; 1; 0; 0], … [1; 1; 1; 1] and I end up with an all 1 4×1 vector. I don't know how to make this work, and I cannot move on to the rest of the assignment without this part.
Best Answer