You can create a delta function using this
function y = delta(n)
y = n == 0;
end
Then a for loop can be used to evaluate the summation, like
sum = 0;
for k = -1000:1000
temp = delta(n-4*k)-delta(n-1-4*k);
sum = sum+temp;
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!