% freqtune.m -- Plot frequency response of plucked string filter for
% delay length L and time delay d.

function freqtune(L, d)

R = .999;	% Damping to create stable comb filter.
RL = R^L;

% Plucked string filter with all-pass filter for fine tuning

a = (1-d)/(1+d);% Approximate formula for a, accurate for low freqs.
b3 = [a, (1+a), 1];
a3 = [2, 2*a, zeros(1,L-2), -a*RL, -(1+a)*RL, -RL];
freqz(b3, a3);
