Is it correct? (dirac delta function)
5 次查看(过去 30 天)
显示 更早的评论
Hi. I want to stem this function,

and this is my code.

i wonder it is correct.
0 个评论
采纳的回答
Walter Roberson
2020-4-19
no it should be 2*(n==0)
However there is another sense in which dirac(x) should be infinite when x is 0 instead being 1.
0 个评论
更多回答(1 个)
Ameer Hamza
2020-4-19
You code is correct. Another way is to use built-in kroneckerDelta function.
n = sym(-5:5);
xn = kroneckerDelta(n,-2) - 2*kroneckerDelta(n,0) + kroneckerDelta(n,2);
stem(n, xn, 'b', 'filled')
axis([-10 10 -5 5])
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surrogate Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!