% aptransient.m
%
% A Matlab script to investigate the transient response of a
% first-order allpass filter with varying allpass coefficient.
%
% by Gary Scavone, McGill University, 2004.

% Fractional delays:
delta = [0.1:0.3:1]';

% Allpass filter coefficients:
a1 = (1 - delta) ./ (1 + delta);
a = [ones(size(delta)) a1];
b = [a1 ones(size(delta))];

% Input impulse signal:
x = [1, zeros(1, 40)];

% Impulse responses:
y = [];
for n = 1:length(delta),
  y = [y; filter(b(n,:), a(n,:), x)];
end

plot([0:length(x)-1], y')
axis([0 10 -0.4 1])
grid
legend(num2str(delta))
xlabel('Time (samples)');
ylabel('Impulse Response');
