We've got a columnvector m x 1 and a matrix m x n. For the value in row i in the columnvector we want to multiply this value with each value in the same row i of the matrix, and then sum all of these up. This is to be repeated for every row i in the vector so that we end up with a columnvector.
Want to do this with a for-loop, have this so far (where M is the matrix and v is the initial columnvector we start out with) which returns an error that says "Subscripted assignment dimension mismatch.", so I guess I messed up with my indices somehow:
for i = 1:nv
for k = 1:mM
columnvectorendresult(i,) = columnvectorendresult(i,) + v(i,:)*M(i,:);
end
end
Don't know if I'm close with what I have so far, but not fully into this just yet. Any suggestions?
v.'*M,M.'*v, my brain is not on 100% today.olumnvectorendresult(i,k), that can't be correct. Please provide a minimal example, from your description it's not clear if you expect a mx1 or 1xn output.v.*sum(M,2)