DSPRelated.com
Forums

how to get impulse response of a 5-poles synchronously tuned filter

Started by newbird2015 October 7, 2015
Hi,
    I am new for DSP area,  currently I have a transfer function(real
function) for 5-poles synchronously tuned filter, and I can do frequency
domain multiplication with the spectrum of the input signal. But I also
want to do a time domain filtering with this 5-poles synchronously tuned
filter and compare with the results of frequency domain multiplication.
However I don't have the 
impulse response of 5-poles filter, then what I did is to try to get
impulse response from frequency transfer function by using IFFT. After
IFFT, I get a complex time domain signal. And I tried to use cconv to see
if I can get data match from frequency domain and time domain operation, I
pastes my code below, though it can match, but I still feel it's different
than time domain filtering with this filter.  I have the following
questions below:
    
1. does anyone know if there's a impulse response of a 5-poles
synchronously tuned filter documented in somewhere? Is it complex
function? I googled some documents mentioned they did time domain filering
with this 5-poles synchronously tuned filter, so just wondering how they
did it.

2. Assume time domain operation with conv function with known impulse
response, then it will be different than operations I am currently using
by circular conv which introduces aliasing? 

 I really appreciate anyone's help here!

  clear all;
  close all;
  
  Fs = 2.5e6;
  in_length = 512;
  input_data = randn(1, in_length) + 1j*randn(1, in_length);
  
  input_data_freq = fft(input_data);
  
  fft_size = 512;
  N = 5;
  freq_offset = 200e3;
  f0 = 3e4/2/sqrt(2^(1/N)-1);
  mask = ((((-fft_size/2:1:fft_size/2-1)*Fs/fft_size - freq_offset)/f0
).^2 + 1 ).^(-N/2);  
  
  filter_td = ifft(mask);

  data_masked = input_data_freq .* mask;
  
  filter_data_from_fd  = ifft(data_masked);
  
  filter_data_from_td = cconv(input_data, filter_td,fft_size);
  
  figure;
  plot(abs(filter_data_from_fd),'-r');
  hold on;
  plot(abs(filter_data_from_td),'-b');
  grid;
  legend('FD filter','TD filter');

Thanks,
newbird2015


---------------------------------------
Posted through http://www.DSPRelated.com
On Wed, 07 Oct 2015 20:30:42 -0500, newbird2015 wrote:

> Hi, > I am new for DSP area, currently I have a transfer function(real > function) for 5-poles synchronously tuned filter, and I can do frequency > domain multiplication with the spectrum of the input signal.
"Synchronously tuned filter" meaning what? A bunch of resonators buffered by amplification stages, or something else? Is the filter operating in continuous time (if it's the definition I found), or is it in sampled time?
> But I also > want to do a time domain filtering with this 5-poles synchronously tuned > filter and compare with the results of frequency domain multiplication.
To what purpose?
> However I don't have the impulse response of 5-poles filter, then what I > did is to try to get impulse response from frequency transfer function > by using IFFT. After IFFT, I get a complex time domain signal. And I > tried to use cconv
cconv would be Matlab jargon. This is a DSP group. Matlab != DSP. Please say what you're really doing, in DSP terms. If you're doing your math correctly the output of the IFFT should be mostly real. If it isn't, you're not doing your math correctly.
> to see if I can get data match from frequency domain > and time domain operation, I pastes my code below, though it can match, > but I still feel it's different than time domain filtering with this > filter. I have the following questions below: > > 1. does anyone know if there's a impulse response of a 5-poles > synchronously tuned filter documented in somewhere? Is it complex > function? I googled some documents mentioned they did time domain > filering with this 5-poles synchronously tuned filter, so just wondering > how they did it.
How are you distinguishing time domain filtering from frequency domain filtering? All filtering in the real world happens in the time domain, because that's the domain we're stuck in. The frequency domain is just a mathematical convenience for solving certain types of differential equations.
> 2. Assume time domain operation with conv function with known impulse > response, then it will be different than operations I am currently using > by circular conv which introduces aliasing?
You have a keyboard, use it. C o n v o l u t i o n -- is it all that hard? Yes, using any sort of discrete Fourier transform as part of an approximation of what will happen in a continuous-time system will introduce artifacts. If you make your sampling frequency high enough that should help. -- www.wescottdesign.com
Thank you for your comments! I comment in lines below.
>On Wed, 07 Oct 2015 20:30:42 -0500, newbird2015 wrote: > >> Hi, >> I am new for DSP area, currently I have a transfer function(real >> function) for 5-poles synchronously tuned filter, and I can do
frequency
>> domain multiplication with the spectrum of the input signal. > >"Synchronously tuned filter" meaning what? A bunch of resonators >buffered by amplification stages, or something else? > >Is the filter operating in continuous time (if it's the definition I >found), or is it in sampled time?
[newbird2015]: this filter performs as a resolution bandwidth filter, and used in time domain. And from what I understand from document, it is like used in continuous time. But in my purpose, I want to use digital domain to do it and perform similarly as in time domain.
> >> But I also >> want to do a time domain filtering with this 5-poles synchronously
tuned
>> filter and compare with the results of frequency domain
multiplication.
> >To what purpose?
Assume time domain is the current practical one. I just want to use frequency digital domain to do the same thing.
> >> However I don't have the impulse response of 5-poles filter, then what
I
>> did is to try to get impulse response from frequency transfer function >> by using IFFT. After IFFT, I get a complex time domain signal. And I >> tried to use cconv > >cconv would be Matlab jargon. This is a DSP group. Matlab != DSP. >Please say what you're really doing, in DSP terms.
Sorry, I didn't make it clear, cconv is circular convolution. And since I am using the same length in frequency domain and in time domain to do the convolution, eventually from my understanding, there's aliasing. But considering in real time domain operation, I would assume there's no aliasing. Then my frequency operation is not exactly the same as in time domain.
> >If you're doing your math correctly the output of the IFFT should be >mostly real. If it isn't, you're not doing your math correctly. > >> to see if I can get data match from frequency domain >> and time domain operation, I pastes my code below, though it can
match,
>> but I still feel it's different than time domain filtering with this >> filter. I have the following questions below: >> >> 1. does anyone know if there's a impulse response of a 5-poles >> synchronously tuned filter documented in somewhere? Is it complex >> function? I googled some documents mentioned they did time domain >> filering with this 5-poles synchronously tuned filter, so just
wondering
>> how they did it. > >How are you distinguishing time domain filtering from frequency domain >filtering? All filtering in the real world happens in the time domain, >because that's the domain we're stuck in. The frequency domain is just a
>mathematical convenience for solving certain types of differential >equations. > >> 2. Assume time domain operation with conv function with known impulse >> response, then it will be different than operations I am currently
using
>> by circular conv which introduces aliasing? > >You have a keyboard, use it. C o n v o l u t i o n -- is it all that >hard?
Sorry. I will make it clear.
> >Yes, using any sort of discrete Fourier transform as part of an >approximation of what will happen in a continuous-time system will >introduce artifacts. If you make your sampling frequency high enough >that should help. > >-- >www.wescottdesign.com
--------------------------------------- Posted through http://www.DSPRelated.com
On Thu, 08 Oct 2015 12:28:49 -0500, newbird2015 wrote:

> Thank you for your comments! I comment in lines below. >>On Wed, 07 Oct 2015 20:30:42 -0500, newbird2015 wrote: >> >>> Hi, >>> I am new for DSP area, currently I have a transfer function(real >>> function) for 5-poles synchronously tuned filter, and I can do > frequency >>> domain multiplication with the spectrum of the input signal. >> >>"Synchronously tuned filter" meaning what? A bunch of resonators >>buffered by amplification stages, or something else? >> >>Is the filter operating in continuous time (if it's the definition I >>found), or is it in sampled time? > [newbird2015]: this filter performs as a resolution bandwidth filter, > and used in time domain. And from what I understand from document, it is > like used in continuous time. But in my purpose, I want to use digital > domain to do it and perform similarly as in time domain.
I know I'm sounding like a cranky old man here (I'm only sorta cranky and sorta old, but hey) -- if you're working off a document, reference it! Then we'll all know what you're talking about in detail. If the document is available on the web and not behind a paywall, link to it.
>> >>> But I also want to do a time domain filtering with this 5-poles >>> synchronously > tuned >>> filter and compare with the results of frequency domain > multiplication. >> >>To what purpose? > > Assume time domain is the current practical one. I just want to use > frequency digital domain to do the same thing.
I don't think you're using those terms the same way everyone else does. "Time domain" means that you're expressing everything in terms of either sampled or continuous time. "Frequency domain" means that you're expressing everything in terms of frequency. Basically, the frequency domain is one Fourier transform away from the time domain, and visa versa. If you want to be clear about whether you're talking about sampled time (and, hence, digital signal processing), then say "sampled time". Otherwise say "continuous time". There aren't really equivalent terms for frequency domain stuff (unless you're talking about Laplace domain and z domain), but usually it's clear.
>>> However I don't have the impulse response of 5-poles filter, then what > I >>> did is to try to get impulse response from frequency transfer function >>> by using IFFT. After IFFT, I get a complex time domain signal. And I >>> tried to use cconv >> >>cconv would be Matlab jargon. This is a DSP group. Matlab != DSP. >>Please say what you're really doing, in DSP terms. > > Sorry, I didn't make it clear, cconv is circular convolution. And since > I am using the same length in frequency domain and in time domain to do > the convolution, eventually from my understanding, there's aliasing. But > considering in real time domain operation, I would assume there's no > aliasing. Then my frequency operation is not exactly the same as in time > domain.
That's correct. There's actually two things going on, and the approximation is happening in the time domain -- the FFT is exact. The two things you're doing are, first, sampling the continuous impulse response, and second, truncating it. After that, as I said, the FFT and IFFT is exact. The sampling is what causes aliasing: if you're sampling fast enough then the aliasing won't be severe. The truncation causes other weirdnesses, but if your vector is long enough that the response has largely died off then once again you'll probably be OK. There's ways of quantifying this stuff, but I wouldn't want to even start unless you've gotten a basic signal processing course or the equivalent under your belt. HTH. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com