let us consider following code for impulse function
function y=impulse_function(n); y=0; if n==0 y=1; end end
this code
>
You can write an even simpler function:
function y=impulse_function(n); y = n==0;
Note that this will return y as a type logical array but that should not affect later numerical computations.
y