MATLAB: Negative index of matrix

diodematrixnegative index

I want to implement this code but I am unable to do so…
for m = 3:-1:-3
for n = 3:-1:-3
Y( m,n) = G(center_index + (m-n)) + (-1i*m*w*C(center_index + (m-n)));
end
end
G and C are vectors.
Can someone please help?

Best Answer

Like this
m = 3:-1:-3;
n = 3:-1:-3;
for i = 1:numel(m)
for j = 1:numel(n)
Y( i,j) = G(center_index + (m(i)-n(j))) + (-1i*m(i)*w*C(center_index + (m(i)-n(j))));
end
end