How this write in summation form in matlab a0*b0+a1*b​1+........​..........​.an*bn?

조회 수: 1 (최근 30일)
Abu Zar
Abu Zar 2023년 1월 10일
편집: Dyuman Joshi 2023년 1월 10일
limit is from 0 to n
  댓글 수: 3
Dyuman Joshi
Dyuman Joshi 2023년 1월 10일
Thanks for the correction @John D'Errico, I overlooked it
the cyclist
the cyclist 2023년 1월 10일
편집: the cyclist 2023년 1월 10일
The solution in @Dyuman Joshi's comment above assumes that a and b are row vectors. If they are column vectors, it will result in matrix output.
Better to use dot(), I would say. See my solution.

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

채택된 답변

the cyclist
the cyclist 2023년 1월 10일
Assuming you actually have vectors, and not variables named a0, a1, a2, etc., then you can use the dot function:
a = [1 2 3]';
b = [4 5 6];
dot(a,b)
ans = 32
Note that this will work on row vectors, column vectors, or even a mixture (which is how I defined them in this example).

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by