2x2 matrix multiplied by a 2x1 column vector gives erratic results
51 Ansichten (letzte 30 Tage)
For example: A=[3,-2;2,-2] times v=[1;-1] works, but fails if A=[1,2;3,4]. The problem seems to be that in Matlab matrix multiplication the elements in row A are multiplied by the corresponding columns in B. Here B has only one column, and needs that the column elements in A be multiplied by the corresponding row elements in B. I have circumvented this problem by writing a function that does the latter, but as the need is for applying a vector to a transformation matrix, I am surprised to discover that the standard matrix multiplication algorithm cannot be relied upon. When it fails it takes A=[a1,b1;a2,b2] and computes v1a1+v2b1;v1a2+v2b2] instead of v1(a1+a2);v2(b1+b2). Is there away around this problem other than my function?