This link shows that there is a kronecker delta function in matlab. However:
>> help kroneckerDelta kroneckerDelta not found
I am u
The Kronecker delta returns 1 if j==k...
So you could simplify the expression with:
function d=kronDel(j,k) d=j==k end
Luckily, MATLAB represents booleans as (0,1)