FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > DSP

DSP comp.dsp newsgroup, mailing list

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-24-2009, 11:22 AM
fittipaldi
Guest
 
Posts: n/a
Default Knowledge help: How to create own filter if I know frequency response?

I need help with the knowledge ...

Let's assume I have an idea for a 1024 point filter. I know how th
frequency response should be: all points between 100 and 924 are 0 and al
other 1 (I think this should be a perfect low-pass (or maybe not?). So
know the f.response. Now how to filter my signal? What I think i
following:

1.) IFFT convert the frequency response to impulse response (fro
frequency to time domain);
2.) apply some kind of window (hamming for example) by multiplying all th
points after the IFFT with the formula of the window;
3.) now convolute with the signal I receive in time domain (by multiplyin
and summing all the signal's points from 1024 upwards with every point fro
the filter).
4.) What I received is the filtered signal ...

Is this true?
Reply With Quote
  #2 (permalink)  
Old 03-24-2009, 11:32 AM
SG
Guest
 
Posts: n/a
Default Re: Knowledge help: How to create own filter if I know frequencyresponse?

On 24 Mrz., 11:22, "fittipaldi" <em.fittipa...@abv.bg> wrote:
> Let's assume I have an idea for a 1024 point filter. I know how the
> frequency response should be: all points between 100 and 924 are 0 and all
> other 1 (I think this should be a perfect low-pass (or maybe not?). So I
> know the f.response. Now how to filter my signal? What I think is
> following:
>
> 1.) IFFT convert the frequency response to impulse response (from
> frequency to time domain);
> 2.) apply some kind of window (hamming for example) by multiplying all the
> points after the IFFT with the formula of the window;
> 3.) now convolute with the signal I receive in time domain (by multiplying
> and summing all the signal's points from 1024 upwards with every point from
> the filter).
> 4.) What I received is the filtered signal ...
>
> Is this true?


You can use the FFT to design filters and also to apply them
efficiently. For designing I would use a larger "FFT size" (for
example 8192) and reasonably smooth magnitude response (no quick
jumps) to fight wrap-around errors, apply the iFFT, apply window
function (now of length 1024). Et voila!

But in your case (lowpass filter) you should use the "windowed sinc"
design method. It's "equivalent" to the procedure above for "FFT-size
= infinity". ( http://www.dspguide.com/ch16.htm )

You may also be interested in the properties of various window
functions
( http://en.wikipedia.org/wiki/Window_function )

Cheers!
SG

Reply With Quote
  #3 (permalink)  
Old 03-24-2009, 12:30 PM
fittipaldi
Guest
 
Posts: n/a
Default Re: Knowledge help: How to create own filter if I know frequency response?

>On 24 Mrz., 11:22, "fittipaldi" <em.fittipa...@abv.bg> wrote:
>> Let's assume I have an idea for a 1024 point filter. I know how the
>> frequency response should be: all points between 100 and 924 are 0 an

all
>> other 1 (I think this should be a perfect low-pass (or maybe not?). S

I
>> know the f.response. Now how to filter my signal? What I think is
>> following:
>>
>> 1.) IFFT convert the frequency response to impulse response (from
>> frequency to time domain);
>> 2.) apply some kind of window (hamming for example) by multiplying al

the
>> points after the IFFT with the formula of the window;
>> 3.) now convolute with the signal I receive in time domain (b

multiplying
>> and summing all the signal's points from 1024 upwards with every poin

from
>> the filter).
>> 4.) What I received is the filtered signal ...
>>
>> Is this true?

>
>You can use the FFT to design filters and also to apply them
>efficiently. For designing I would use a larger "FFT size" (for
>example 8192) and reasonably smooth magnitude response (no quick
>jumps) to fight wrap-around errors, apply the iFFT, apply window
>function (now of length 1024). Et voila!
>
>But in your case (lowpass filter) you should use the "windowed sinc"
>design method. It's "equivalent" to the procedure above for "FFT-size
>= infinity". ( http://www.dspguide.com/ch16.htm )
>
>You may also be interested in the properties of various window
>functions
>( http://en.wikipedia.org/wiki/Window_function )
>
>Cheers!
>SG
>
>


Yep, I use exactly the method from this book. My problem is I know th
frequency response and want to substitute in K (if we read chapter 16), th
sinc function, with my own filter idea ...
Reply With Quote
  #4 (permalink)  
Old 03-25-2009, 11:34 AM
Rune Allnor
Guest
 
Posts: n/a
Default Re: Knowledge help: How to create own filter if I know frequencyresponse?

On 24 Mar, 11:22, "fittipaldi" <em.fittipa...@abv.bg> wrote:
> I need help with the knowledge ...
>
> Let's assume I have an idea for a 1024 point filter. I know how the
> frequency response should be: all points between 100 and 924 are 0 and all
> other 1 (I think this should be a perfect low-pass (or maybe not?).


Everybody *think* this is a perfect low-pass filter,
but it isn't. It's a disaster waiting to happen.
I'll show you below.

Just out of curiosity: If it is this easy to specify
a filter, why are there so many other methods for
filter design? Window functions, with the sidelobe
ripple and transition bandwidths; Optimization methods
with all these iterative computational nuisances?
Are these method there just because somebody wanted
to sell show-off books stuffed with maths, to screw
with student's minds in exams? Or could it be that
these methods actually are there for a reason?

Just contemplate those questions for a moment.

The the problem is that your specification above only
determines the filter response in a set of points along
the frequency axis. Those points are implicitly given
by the number of points in the data vector.

Some matlab code to illustrate:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%
N =32; % The number of samples in filter
H = zeros(N,1);
H(1:5) = 1;
H(end-3:end)=1; % 'Ideal' frequency response
w = (0:N-1)/N; % Frequency vector

clf
subplot(2,1,1)
stem(w,H,'b'),hold on % Plot the spec
title('Spectra')

h = fftshift(real(ifft(H)));
% Compute impulse response of filter
subplot(2,1,2)
stem(h,'b'),hold on % Plot impulse response
title('Impulse responses')

% At this point all looks well. The DFT of the filter
% looks like what you want, and you have got a FIR
% impulse response you can use.

% Let's see what happens if you apply the filter to
% a data set with a different number of samples.

h1 = [h; 0; 0 ;0]; % Append 3 samples to the FIR
stem(h1,'r') % Plot it ontop of the original,
% No difference in time domain

H1 = abs(fft(h1)); % Compute DFT of new filter
w1 = (0:length(H1)-1)/length(H1);
% and corresponding frequency
% vector
subplot(2,1,1)
stem(w1,H1,'r') % plot on top of original
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%

The DFT of the zero-padded filter doesn't quite look
like what you expected, right?

This is why your way of specifying the filter response
is a bad one. The usual methods specify responses in
bands, not points, so with them you control ripple in
the various bands. Stick with the usual methods and you
get no surprises like this.

Rune
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FIR filter frequency response Zeph80 DSP 10 10-26-2008 10:13 AM
Frequency response of PI filter pinku DSP 5 07-11-2007 02:57 PM
IIR filter frequency response Dani DSP 20 09-13-2004 08:25 AM
Filter with (x/sin(x))^N frequency response? David Joseph Bonnici DSP 9 06-04-2004 07:08 AM
Frequency response of an FIR filter I. R. Khan DSP 4 02-18-2004 02:31 AM


All times are GMT +1. The time now is 09:08 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved