Basically, the code I'm trying to write will take an array of data, sum it, and find the solution. The sum is known before hand, but whether the data values are positive or negative are not. I'm thinking I could do this using some sort of double for loop marking coefficients as either 1 or -1 but I'm stuck. Any advice? (I'll show an example)
clear,clcsumm = 2data = [8, 12, 2]%loops
%...
%SOLUTION
ans = [8 -12 6]>>
Best Answer