Reputation: 11
this is the problem that is about digital signal professor does not want let me use for function so i tried using sum function this is what i tried:
>> n = -10:10;k = -5:5;x = sum(exp(-abs(k)) .* ((n-2*k)==0));
[error: operator -: nonconformant arguments][3] (op1 is 1x21, op2 is 1x11)
i know why it makes error but i don't know how to sum with two variables...
Upvotes: 0
Views: 219
Reputation: 11
I found the solution:
>> n = -10:10;>> k = -5:5;>> x = exp((-abs(k))) * ((n-2*k')==0);>> stem(n,x,'filled');
Upvotes: 1