1
votes

I am designing a fractional delay filter, and my lagrange coefficient of order 5 h(n) have 6 taps in time domain. I have tested to convolute the h(n) with x(n) which is 5000 sampled signal using matlab, and the result seems ok. When I tried to use FFT and IFFT method, the output is totally wrong. Actually my FFT is computed with 8192 data in frequency domain, which is the nearest power of 2 for 5000 signal sample. For the IFFT portion, I convert back the 8192 frequency domain data back to 5000 length data in time domain. So, the problem is, why this thing works in convolution, but not in FFT multiplication. Does converting my 6 taps h(n) to 8192 taps in frequency domain causes this problem?

Actually I have tried using overlap-save method, which perform the FFT and multiplication with smaller chunks of x(n) and doing it 5 times separately. The result seems slight better than the previous, and at least I can see the waveform pattern, but still slightly distorted. So, any idea where goes wrong, and what is the solution. Thank you.

The reason I am implementing the circular convolution in frequency domain instead of time domain is, I am try to merge the Lagrange filter with other low pass filter in frequency domain, so that the implementation can be more efficient. Of course I do believe implement filtering in frequency domain will be much faster than convolution in time domain. The LP filter has 120 taps in time domain. Due to the memory constraints, the raw data including the padding will be limited to 1024 in length, and so with the fft bins.

Because my Lagrange coefficient has only 6 taps, which is huge different with 1024 taps. I doubt that the fft of the 6 taps to 1024 bins in frequency domain will cause error. Here is my matlab code on Lagrange filter only. This is just a test code only, not implementation code. It's a bit messy, sorry about that. Really appreciate if you can give me more advice on this problem. Thank you.

t=1:5000;
fs=2.5*(10^12);
A=70000;

x=A*sin(2*pi*10.*t.*(10^6).*t./fs);

delay=0.4;
N=5;

n = 0:N;  
h = ones(1,N+1);  

for k = 0:N  
      index = find(n ~= k);  
      h(index) = h(index) *  (delay-k)./ (n(index)-k);  
end  

pad=zeros(1,length(h)-1);  
out=[];  
H=fft(hh,1024);  
H=fft([h zeros(1,1024-length(h))]);  
for i=0:1:ceil(length(x)/(1024-length(h)+1))-1  

    if (i ~= ceil(length(x)/(1024-length(h)+1))-1)  
        a=x(1,i*(1024-length(h)+1)+1:(i+1)*(1024-length(h)+1));  
    else  
        temp=x(1,i*(1024-length(h)+1)+1:length(x));  
        a=[temp zeros(1,1024-length(h)+1-length(temp))];  
    end  

    xx=[pad a];
    X=fft(xx,1024);


    Y=H.*X;
    y=abs(ifft(Y,1024));
    out=[out y(1,length(h):length(y))];
    pad=y(1,length(a)+1:length(y));  

end
1
From your description, the first technique you tried should have worked. Can you post your code and why you think the result is wrong? Also, for a 6-tap FIR filter, there is probably not much advantage in overlap-save processing. But if you want to see an example, the second code block here might be of interest: stackoverflow.com/questions/2929401/…mtrw
You code does not run as hh and x are undefined.mtrw

1 Answers

0
votes

Some comments:

  1. The nearest power of two is actually 4096. Do you expect the remaining 904 samples to contribute much? I would guess that they are significant only if you are looking for relatively low-frequency features.
  2. How did you pad your signal out to 8192 samples? Padding your sample out to 8192 implies that approximately 40% of your data is "fictional". If you used zeros to lengthen your dataset, you likely injected a step change at the pad point - which implies a lot of high-frequency content.
  3. A short code snippet demonstrating your methods couldn't hurt.