Dear forum Members,
I have to design a filtration in wide 650 MHz band. Detection algorithm finds signals in this band and provides information like: start and stop frequency. I need to filter it out but the bandwidth will vary depends on detected signal. Question is, how to tackle this problem? My first idea was to design few FIR impulse responses and store it in memory and then depends on detected signal, shift it to the baseband and use the most suitable filter coefficients. This approach forces us to design quiet a lot of filters. Since my experience is still low I ask you for advise. Moreover, I also want it to be fast so any implementation tips would be highly appreciated.
I have done similar filtering tasks using a a cascade of polyphase filter banks. First an analysis filter bank partitioning the positive frequencies into multiple baseband time domain signals aliased to DC by the down-sampling process. It could be 512 , non-maximally decimated channels which would give you multiple 1.3 MHz bandwidth signals. You can cascade another analysis filter bank in each band that exhibits energy activity... you then pass on to the dual synthesis filter banks the channels you wish to pass along and do not pass on the channels you wish to reject (a binary mask) your synthesized output will have spectral holes reflecting the masked channels. If you can find a copy of multirate signal processing, there are a number of related systems described in there.
One way is to have a reference filter cutting off sharpest then decimate coeffs as required. cutoff moves double per decimation by 2
Could you explain that little bit more? What do you mean by saying "reference filter"?
Sharpest cutoff with suitable number of coeffs you can afford. Any higher cutoff (but not lower) can be achieved by decimating the coeffs:
decimate by 2 or 3 or 4...etc. cutoff moves higher by same ratio.
for example if your FIR cuts off at .2 sampling rate then if decimated by 2 it cuts off at .2*2 = .4
if decimated by 3 it cuts off at .2*3 = .6 and so on.
Note: alternative is change sampling rate if applicable.
I get it now. First design a narrow-passband lowpass filter with sharp cutoff edge and then if pass-band is not wide enough, decimate filter coefficients by appropriate value to increase pass-band. Am I right?
Actually decimation will be possible and I think that even desirable because detected signals bandwidth will not exceed 20 MHz so maybe decimation will do the job at the first stage?
yes that is correct. for passband at say [.1 ~ .2] if you decimate by n it will move to n*(.1 ~ .2)
Have you considered filtering in the frequency domain using overlap-add or overlap-save?
Since you simply zero out the bins you don't want, this will be one operation even if you have several interferers each with its own bandwidth.
Thanks for answer. Are you talking about fast convolution algorithm?
Zeroing don't wanted bins sounds good, but I am not loosing some information during that process? Case I assume that you are suggesting running FFT, then zero unwanted frequencies and then IFFT to synthesize wanted signal, am I right?
Yes, I am talking about filtering in the frequency domain which involves FFT, multiplying frequency by frequency, and the iFFTing back into the time domain. (You can call this fast convolution because it runs in O(N log N) instead of O(N^2), but whether it is really faster depends on N. However, your question relates to the filter design issue, not to the complexity of running.)
No information is lost except the information in the zeroed out bins, which is what you want to lose.
I assume that you want to run this in real-time so you can't simply take a giant chunk and FFT the whole thing. In order to correctly put together the separate chunks you should use one of the 2 methods I mentioned in my original reply. (The methods are explained in DSPCSP section 15.2)
yes, I want to run it in real time indeed, so implementation is also crucial. We have quiet powerful hardware but it is also easy to overload by too long FFTs. I read about overlap-save and overlap-add algorithms but back then I didn't think they might be useful in my case.
But if, lets say I need to zero most of the bins in FFT cause signal of interest is narrowband wrt sampling frequency, is calculating IFFT a good idea (I mean in terms of calculations amount)? Maybe decimation would do the job?
If the signal of interest is narrowband then why are you notching out the interferers? You should be bandpassing the signal of interest. That is indeed best done via (multistage) decimation.
Interferences must be filtered out because in the end signal has to be demodulated. I said that signals might be narrowband but on the other hand signal might be 20 MHz or 40 MHz and that's the problem (we are monitoring the spectrum), to choose filtration that gives best selectivity and flexibility to be appropriate for different bandwidths.
I hope you got my idea.
No, I don't understand. If the signal of interest is in the bandpass then it can be demodulated. If the interfering signals are also in the bandpass, then there may be good reasons to reduce them (in order to avoid saturating filters, etc.) but in general you have lost the information at those frequencies and may not be able to demodulate correctly. It depends on the modulation type, the ratio of hte lost bandwidth to the signal bandwidth, and the signal to interference ratio at the problematic frequencies.
For example, if you have an OFDM signal and a strong interferer at a particular subcarrier, then you lost that subcarrier. If you have one large QAM and lose only a small fraction of the bandwidth, you will probably be all right (but the constellation may be distorted - it won't show the fuzzy points of uncorrelated noise or the replication of ISI).
To better understand my problem I have prepared an image which shows exemplary situation. There are few signals in the spectrum. My task is to filter out each of them (red, green, yellowish and grey) and provide filtered samples to different entity. It has to be done efficiently but not in real-time. Algorithm is going to be written in python. Lets think about red one. To filter it out I thought about shifting it to the zero frequency and then resample it down using 'resample' function. It works well in Matlab but I am wondering if it is efficient cause every time I call 'resample' function, new coefficients for FIR filter have to be calculated. Question is, what is the optimal solution to filter those signals out, where center frequency and bandwidth of each signal is given.
Thanks in advance,
Sorry for not following you. Filtering out means to remove a signal. So you want to filter out the red signal and leave all the others? And then filter out the green leaving all the others?
Or do you want to do signal separation and retrieve each of the colors separately (i.e., in your diagram produce 4 different signals)?
If you merely want to filter out the red signal then indeed you can design a bandstop filter, but if the rest needs to maintain phase linearity then I am unsure about running a reasonable FIR filter in Python... FFT should be faster (try a good FFT like FFT842 or "the fastest FFT in the West". On a DSP an FIR runs faster than FFT, but in Python FIR will be intolerably slow.
If you don't care about phase, then you can build an efficient ARMA filter to filter out the red signal.
If what you really want is to separate the signals then you can do a single input multiple out overlap-add or overlap-save. You do a single FFT, create the N output signals in the frequency domain by selecting the required bins, and then proceed with each separately. That will be efficient.
Sorry for not being clear enough. By saying "filtering out" I meant to down-convert this signal and reject another signals (so if I want to demodulate let's say red one I need to shift red signal to the zero frequency region and remove other signals). To simplify the problem let's assume that I am interested in one particular signal - red one. How to separate red one from others and do it efficiently?
Yes, exactly! There could be also a situation that I am interested in each of signal and, as you said, I need to produce 4 different signals. How to perform such a filtration when signal of interest might change its bandwidth? I have no knowledge about incoming signals. As I mentioned earlier, bandwidth and center frequency are only instantaneous parameters for my filtration algorithm, but they might change rapidly (e.g. new signal appeared and few disappeared), how to extract signals from spectrum where their bandwidth and center frequency are changing?
Of course there is not such a limitation that it should be python. Any other software is free to use like FFTW. Thank you for this advice.
Actually I care about the phase cause next step, after filtration, will be an attempt to demodulate this signals.
After my comments above, are you still recommending going into filtration in frequency domain using FFT?
Thanks for helping me,
Sorry for misunderstanding, I am not native speaker ;)
There are many ways to do the job. If you shift band to dc then I suggested decimating your filter coeffs.
Another way is to cascade several copies of a LPF (e.g. halfband) filter. At each stage you filter and also directly decimate signal output by 2 (pick every other sample). Then you select the relevant filter output.
For example you received 1MHz signal. This will be the last filtered output. While the 50MHz case will be the first filtered output before decimation.
How many filters you need may be five stages giving 2^5 cutoff reduction. Remember if filter cutoff is Fs/4 so next stage will be (Fs/2)/4 = Fs/8 and so on.
You will need to do that equally on real and imaginary if your signal is complex.