Hd = dfilt.delay
Hd = dfilt.delay(latency)
Hd = dfilt.delay(latency) returns a discrete-time filter, Hd, of type delay, which adds the number of delay units specified in latency to any signal filtered with Hd. The filtered signal has its values shifted by the latency number of samples. The values that appear before the shifted signal are the filter states.
Create a delay filter with a latency of 4 and filter a simple signal to view the impact of applying a delay.
h = dfilt.delay(4); Fs = 1000; t = 0:1/Fs:1; sig = cos(2*pi*100*t); y = filter(h,sig); subplot(211); stem(sig,'markerfacecolor',[0 0 1]); axis([0 20 -2 2]); title('Input Signal'); subplot(212); stem(y,'markerfacecolor',[0 0 1]); axis([0 20 -2 2]); title('Delayed Signal');