1
2
3
4
5
6
7
8
9
10
A = [1 2 3 4 5 6 7 8 9 10 11 12];
B = [1 2 3 4 5 6 7 8 9 10 11 12];
S = 0;
C = zeros(1, length(A));
for m = 1:length(A)
i = length(A) + 1 - m;
CC = B(i) + A(m);
C(m) = CC;
S = S + CC;
end
1
2
3
4
5
6
7
8
9
10
A = [1 2 3 4 5 6 7 8 9 10 11 12];
B = [1 2 3 4 5 6 7 8 9 10 11 12];
S = 0;
C = zeros(1, length(A));
for m = 1:length(A)
i = length(A) + 1 - m;
CC = B(i) + A(m);
C(m) = CC;
S = S + CC;
end