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!