I am trying to solve the following simple task in matlab:

I am trying to do this using for loops. However, I did not understand this.
This is what I came up with so far:
n = [0:1:10];
b = 2*n;
c = 0.5*n;
B=0;
for ii = 1:length(b)
for jj = 1:length(c)
B(ii) = B+sum(b(jj)*c(ii-jj))
end
end
It seems that I ran into a problem when ii = jj and I have c (0) and this index cannot be used. How can i fix this?
source
share