shegmite
Member level 1

Please i need hint on how to manipulate the output from a for loop do summation of differences between that output and a data set. An example is shown below. I tried it but it only computed the sum for the first for loop neglecting the other data set.
Code:
Code:
for f = [1 4 8 10 14];
b=2;
c=1;
d=1;
n=4;
N= f*b*c*d;
M=[4.5 10.5 20.5 25.6 30.8];
Y = (M-N);
A = sum(Y);
end
disp(A)