How this write in summation form in matlab a0*b0+a1*b1+...................an*bn?
1 次查看(过去 30 天)
显示 更早的评论
limit is from 0 to n
3 个评论
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
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)
Note that this will work on row vectors, column vectors, or even a mixture (which is how I defined them in this example).
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!