Matrix Multiplication with large vectors
이전 댓글 표시
Hi,
If I have following problem how can I formulate it in matlab
A=
1 3
2 4
b=
xi
yi
where xi and yi are column vectors with lets say 100 values in each how can I input this problem in Matlab by using following formula
[z1 = A*b
z2]
Please note I have very large martix with vectors xi and yi and I want out put two matrices z1 and z2
Thanks in advance, jay
thanks
댓글 수: 3
Walter Roberson
2015년 5월 11일
Is the number of rows in A the same as the number of elements in xi and yi?
Are you looking for
z1 = A(:,1) .* xi;
z2 = A(:,2) .* yi;
?
amberly hadden
2015년 5월 11일
편집: Walter Roberson
2015년 5월 11일
Walter Roberson
2015년 5월 11일
There seems to be some confusion about whether xi and yi are row vectors or column vectors. You said column vectors before, but [xi;yi] would create a single column vector of the two combined, with [xi,yi] producing two columns from two column vectors.
채택된 답변
추가 답변 (1개)
A = [1 2; 3 4];
xi = 10;
yi = 20;
x = [xi; yi];
z1 = A(1,:)*x;
z2 = A(2,:)*x;
or
z = A*x;
z1 = z(1);
z2 = z(2);
댓글 수: 1
amberly hadden
2015년 5월 15일
편집: Walter Roberson
2015년 5월 15일
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!