2017/10/04

Matlab: Unit Impulse δ[n] 單位脈衝函數

The unit impulse, or the Dirac delta function, has zero values for all input values except a value of one at zero.

To plot the unit impulse function δ[n], type the Matlab code below:

>> t = -10:10;
>> s = (t==0); %s is one only when t equals 0
>> stem(t,s)

Result:



For δ[n-2], the Matlab code is

>> t = -10:10;
>> s2 = (t==2); %s is one when t equals 2
>> stem(t,s2)

Result:


Reference:

沒有留言:

張貼留言