Using sinc as a filter

조회 수: 18 (최근 30일)
Juan
Juan 2014년 5월 5일
편집: Juan 2014년 5월 7일
I'm trying to use a cardinal sine as a lowpass filter for a cosine signal with a fundamental of 1k.
In frequency domain, what really happens is that I'm multiplying two impulses (centered at -1k and 1k) with a rectangular pulse of width equals 2 (convolution is multiplication in frecuency domain). The result would be a constant zero function. However using the above code in Matlab I'm getting again the sinc function as output. Any help would be appreciated (attached the full plot).
D = 5;
f0 = 1000;
fm = 2*f0; % nyquist reestriction
t = (-D:1/fm:D);
x = cos(1000*2*pi*t);
h = sinc(t);
x_p = filter(h,1,x);
plot(x_p);
This questions was also asked on http://dsp.stackexchange.com/questions/15961/using-sinc-as-a-filter but is still unanswered. Using conv(h,x) I'm getting two cardinal sines, also tested with filter(x,1,h)

채택된 답변

Honglei Chen
Honglei Chen 2014년 5월 7일
Hi Juan,
Your filter is as long as your signal, that means whatever you see is basically the transient while Fourier analysis gives the stabilized result. If you shorten your filter to a quarter of length, you will see that after the transient, the result is close to 0. (Note I changed your total points to even to make the bookkeeping easy but you can surely reproduce this with odd number of points)
D = 5;
f0 = 1000;
fm = 2*f0; % nyquist reestriction
t = (-D:1/fm:D-1/fm);
x = cos(1000*2*pi*t);
h = sinc(t(3*numel(t)/8:5*numel(t)/8-1));
x_p = filter(h,1,x);
plot(x_p);
Two more minor comments:
1. Your signal is critically sampled so you have only two points in one period of cosine. This does not impact your result but your signal is actually a zigzag line rather than a sinusoid.
2. I'd like to also point out that sinc function is actually the continuous Fourier transform of a boxcar and in the discrete system, it should be a Dirichlet function. Again, this doesn't really affect your result much but I figure it is better if you align everything correctly. Below is an example if you want to use this approach
ns = numel(t);
ns = ns/4;
f = -fm/2:fm/ns:fm/2-fm/ns;
h1 = ifftshift(diric(f/fm,2*ns));
x_p1 = filter(h1,1,x);
plot(x_p1);
HTH
  댓글 수: 1
Juan
Juan 2014년 5월 7일
편집: Juan 2014년 5월 7일
Thanks Honglei Chen, makes a lot of sense. I knew that boxcar is the dft of sinc but I was trying attack the problem from the time domain.
Just another question, I noticed that when appling the filter I get a line close to zero but I also have a little sinc function present in one corner. Is there any way to improve the filter's performance?
Thanks a lot!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by