MATLAB Answers

0

Weighted linear combination between vectors

Paola 님이 질문을 제출함. 4 Sep 2019
최근 활동 Matt J 님이 편집함. 4 Sep 2019
Hello,
I have a matrix W 32x4. I made the linear combinations of all its column vectors, considering all the possible pairs and triples.
Example:
w1=[1 2 3] w2=[4 5 6] Combination_vector=[5 7 9]. I ideally considered my scalar coefficient as 1. (given the formula C=[aw1+bw2]
I want to now find a vector C that is the weighted linear combination of my vectors
How can I implement it?
Thank you!

  댓글 수: 0

로그인 to comment.

답변 수: 2

Matt J 님의 답변 4 Sep 2019
Matt J 님이 편집함. 4 Sep 2019
 채택된 답변

weights=[1 2 3 4];
C=W*weights(:);

  댓글 수: 0

로그인 to comment.


Torsten 님의 답변 4 Sep 2019
Torsten 님이 편집함. 4 Sep 2019

weights = [0.25 0.25 0.25 0.25];
C = weights(1)*W(:,1) + weights(2)*W(:,2) + weights(3)*W(:,3) + weights(4)*W(:,4);

  댓글 수: 0

로그인 to comment.



Translated by