Clear Filters
Clear Filters

Can you please help me.

2 views (last 30 days)
Jesus Flores
Jesus Flores on 29 Mar 2021
Answered: Mahesh Taparia on 1 Apr 2021
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 Comment
DGM
DGM on 29 Mar 2021
That's not a question. Do you have a question about your attempts to implement such a function?
Hint: 1:2:length(vector)

Sign in to comment.

Accepted Answer

Mahesh Taparia
Mahesh Taparia on 1 Apr 2021
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!

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!