matrix element in summation sign

I have 2 matrix A=[a;b;c] and B=[d;e;f]
Now I want the answer of
So I type the code
syms i
symsum(A(i)*B(i),1,3)
Then there is an error "Indexing input must be numeric, logical or ':'."
But what I mean is A(1)*B(1) + A(2)*B(2) ...
So what is the correct code for this question?

답변 (1개)

Mischa Kim
Mischa Kim 2014년 3월 10일
편집: Mischa Kim 2014년 3월 10일

0 개 추천

Lo, use
syms a b c d e f
A = [a; b; c];
B = [d; e; f];
sum(A.*B)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

lo
2014년 3월 10일

편집:

2014년 3월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by