Weighted linear combination between vectors

조회 수: 2 (최근 30일)
Paola
Paola 2019년 9월 4일
편집: Matt J 2019년 9월 4일
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!

채택된 답변

Matt J
Matt J 2019년 9월 4일
편집: Matt J 2019년 9월 4일
weights=[1 2 3 4];
C=W*weights(:);

추가 답변 (1개)

Torsten
Torsten 2019년 9월 4일
편집: Torsten 2019년 9월 4일
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);

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by