vector multiplied a matrix

조회 수: 3 (최근 30일)
Paul Rogers
Paul Rogers 2020년 6월 11일
댓글: the cyclist 2020년 6월 11일
Hi, I need this multiplication and I can't whats wrong
f=c.*T
where c and T are the attached files.
so I expect a raw vector f where:
f_11 = c_11*T_11 + c_12*T_21 + c_13*T_31 + c_14*T_41 + c_15*T_51;
f_12= c_11*T_12 + c_12*T_22 + c_13*T_32 + c_14*T_42 + c_15*T_52;
and so on.
It's really stupid i know, but I can''t figured out why it's not working.
c has 1 colum and 5 rows, T has 101 colums and 5 rows.
  댓글 수: 4
James Tursa
James Tursa 2020년 6월 11일
Your notation is confusing. You say c has 5 rows and 1 column, yet you use c_12 in your example indicating it has 1 row and 5 columns.

댓글을 달려면 로그인하십시오.

채택된 답변

James Tursa
James Tursa 2020년 6월 11일
편집: James Tursa 2020년 6월 11일
Maybe this is what you want if c is 5 x 1 and T is 5 x 101:
f = c.' * T;

추가 답변 (1개)

the cyclist
the cyclist 2020년 6월 11일
If your version of MATLAB is older than R2016b, then c will not be "implicitly expanded" to the size of T. You can do the following to get what you want:
f = bsxfun(@times,c,T)
  댓글 수: 2
Paul Rogers
Paul Rogers 2020년 6월 11일
I've just did it but I expeted f to be a raw not a matrix.
the cyclist
the cyclist 2020년 6월 11일
Sorry, I missed that you wanted the sum. What you want is actually a matrix multiplication, not an element-wise multiplication, which is the syntax you were trying to use. I think you want this:
f = T'*c;

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by