Write a function that takes a vector as input and returns the sum of every other value in the vector, starting with the first value. Name your function whatever you like

1 个评论

That's not a question. Do you have a question about your attempts to implement such a function?
Hint: 1:2:length(vector)

请先登录,再进行评论。

 采纳的回答

Mahesh Taparia
Mahesh Taparia 2021-4-1

0 个投票

Hi
To define a function, you can refer this documentation on function creation. To add all the vector elements, you can refer this example. Hope it will help!

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息

产品

标签

Community Treasure Hunt

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

Start Hunting!

Translated by