MATLAB: How to sum a vector without sum func given this elements:19^3 −17^3 +15^3 −13^3 +11^3 −9^3 +7^3 −5^3 +3^3 −1^3 notice the sign changing 9 times with 10 element again without sum function\ anyone idea? Best Answer The elements are cubed, so the signs are conserved.This works:v = [19^3 -17^3 +15^3 -13^3 +11^3 -9^3 +7^3 -5^3 +3^3 -1^3];sum_v = v*ones(numel(v),1)Check = sum(v) % Checksum_v = 3970Check = 3970 Related SolutionsMATLAB: Suming vectors which are produced in a loop n=3;sumV=zeros(n,1);for i = 1:n V = [i; 2*i; 3*i]; sumV(i,1)=sum(V,1);end MATLAB: How to sum all elements of a defined vector ‘V’ that are greater than a scalar value of ‘N’, that is also pre-defined Try V_sum = sum(V1(V1 > N)); Related QuestionSum of matrices and loopGet the last 5 column for 1st rowHow to create the array [1, 2,2 ,3, 3, 3, 4,4 4, 4]Calculating cdf with a matrix as an argumentHow to replace half the number of specific element in an array
Best Answer