Sara, it really depends on what you are trying to achieve. For starters you could use two for loops to take care of the summations:
for n = 1:N
for m = 1:M
%your code
end
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!