www.gusucode.com > symbolic 源码程序 matlab案例代码 > symbolic/FilterResponseToKroneckerDeltaInputExample.m

    %% Filter Response to Kronecker Delta Input
% Use |filter| to find the response of a filter when the input is the
% Kronecker Delta function. Convert |k| to a symbolic vector using |sym|
% because |kroneckerDelta| only accepts symbolic inputs, and convert it
% back to double using |double|. Provide arbitrary filter coefficients |a|
% and |b| for simplicity.

% Copyright 2015 The MathWorks, Inc.

b = [0 1 1];
a = [1 -0.5 0.3];
k = -20:20;
x = double(kroneckerDelta(sym(k)));
y = filter(b,a,x);
plot(k,y)