I'm trying to perform a really simple summation in MATLAB. Here is my code:
moment = 0;
for y=1:rows,
for x=1:cols,
moment = moment + (x^p * y^q * Im(y,x));
end
end
I want (x^p * y^q * Im(y,x)) to be calculated for each iteration and added to the moment variable, but this function is returning the moment the first time it's calculated. It doesn't seem to do the adding at all.
Probably a stupid mistake, but I am really confused. Any suggestions?