MATLAB Answers

Calculate power of exponential

조회 수: 4(최근 30일)
gio kapanadze
gio kapanadze 2021년 4월 23일
댓글: Daniel Pollard 2021년 4월 23일
How can i calculate , if A=[8 7 0] and B=[2 12 1];
I tried this code:
A = [8 7 0];
B = [2 12 1];
C = exp(A)
C*B
Matlab keeps giving error: Inner matrix dimensions must agree.

채택된 답변

Daniel Pollard
Daniel Pollard 2021년 4월 23일
Deleted my previous answer as I hadn't seen your edit so gave a wrong answer.
You need a . before the multiplication symbol. Try
A = [8 7 0];
B = [2 12 1];
C = exp(A)
sum(C.*B)
C.*B computes element-wise multiplication of C and B, then sum them to calculate the do product.
  댓글 수: 4
Daniel Pollard
Daniel Pollard 2021년 4월 23일
Are we seeing different versions of the question? To me it says
"How can I calculate , if A=[8 7 0] and B=[2 12 1]" before they outline what they tried and the error it returned.

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

추가 답변(1개)

Mike
Mike 2021년 4월 23일
C.*B
* by itself means matrix multiply
.* means multiply individual terms

Community Treasure Hunt

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

Start Hunting!

Translated by