I need to add and multiply a vetor
1 回表示 (過去 30 日間)
古いコメントを表示
採用された回答
DGM
2022 年 12 月 13 日
You mean something like this?
u = cos(0:pi/20:pi);
v = sum(u(2:end) .* u(1:end-1))
その他の回答 (1 件)
Bora Eryilmaz
2022 年 12 月 13 日
編集済み: Bora Eryilmaz
2022 年 12 月 13 日
This looks like the dot product of the subvectors u(1:n-1) and u(2:end):
u = cos(0:pi/20:pi); % Create the vector
p = u(1:end-1) * u(2:end)' % Use the dot product.
参考
カテゴリ
Help Center および File Exchange で Downloads についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!