I am trying to write a function which takes an input signal and delays it by a non-integer index. The function is based on the ideal bandlimited fractional delay filter technique, already available in Matlab, by calling the function designFracDelayFIR.
I really do not understand why the output signal, instead of being a delayed version of the input signal is a scaled version of it, with much lower amplitude. Also, the scaling factor seems to depend on the fractional delay used.
The input sequence is an audio signal of 4000 samples, at sampling frequency Fs=8 kHz.
The code below shows the function implementation
function [y] = fractionaDelaySequence(fd,x)
%design fractional delay filter
[h,i0,bw] = designFracDelayFIR(fd)
fdf = dsp.FIRFilter(h);
y = fdf(x);
subplot(2,1,1);
stem(x(1:256));
title('Input Sequence');
xlabel('n')
subplot(2,1,2)
stem(y(1:256));
title('FIR Output Sequence');
xlabel('n')
end
EDIT: As a further test, I gave the function as signal input a unit impulse constructed by a 1 followed by a 1023 zeros, and set fd=1/3. I would expect to have as output the same impulse delayed by the desired amount, but instead I get a non-delayed and scaled down version of the input, as depicted in the figure below. The function returns i0=24 and bw=0.9033.
h
? What is your input argumentfd
. What are the values of the other outputsi0
andbw
? $\endgroup$y = filter(h,1,x)
instead. $\endgroup$dsp.FIRFilter
. I've added a bug report on the MathWorks website. $\endgroup$