Consider a vector a write the MATLAB code that returns the i
Consider a vector a, write the MATLAB code that returns the indices of the elements that will sum to exactly half of the sum of all elements. For instance if input a, the output must be ai because sum of all elements in a is 28, and 14 in ai. a = [ 1 2 3 4 5 6 7] ai = [ 1 6 7]
Solution
This is what the input and output for the code are suppose to be: a = [ 1 2 3 4 5 6 7] ai = [ 1 6 7]
I don\'t know how to start. I plugged it into a function and this what I got:
And this was the result after I ran it:
