DSPRelated.com
Forums

filter of amplitude versus filter of (I,Q)?

Started by Chris Bore December 10, 2008
I have a client who filters complex data.

They first calculate the magnitude, then filter that.

I suggested they should filter the complex data, then calculate the
magnitude.

The same filter is used in each case, and the filter coefficients are
purely real.

The results are different, which is not a surprise, but I cannot find
a simple way to explain why this is. Any suggestions would be
welcome. :-)

Thanks,

Chris
================
Chris Bore
BORES Signal processing
www.bores.com
chris@bores.com
On 10 Des, 09:16, Chris Bore <chris.b...@gmail.com> wrote:
> I have a client who filters complex data. > > They first calculate the magnitude, then filter that.
The magnitude of the time-domain IQ data? If so, they compute the envelope which can take only non-zero values. They probably want to compute the *amplitude* which can take both negative and positive values. Whenever I want to compute the envelope of a data set I use this very method: Compute the IQ data and compute the magnitude. If you want to show why filtering the magnitude is wrong, plot a real data set and its IQ magnitude in the same plot.
> I suggested they should filter the complex data, then calculate the > magnitude.
Agreed. Taking the magnitude of a complex number is a non-linear operation, so postpone it to the very end. Once you take the magnitude you have forefeited the linear filters (and most if not all DSP methods) for the downstream processing. A depressively common pitfall. Rune
On Dec 10, 10:24&#4294967295;am, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 10 Des, 09:16, Chris Bore <chris.b...@gmail.com> wrote: > > > I have a client who filters complex data. > > > They first calculate the magnitude, then filter that. > > The magnitude of the time-domain IQ data? > > If so, they compute the envelope which can take > only non-zero values. They probably want to compute > the *amplitude* which can take both negative and > positive values. > > Whenever I want to compute the envelope of a data set > I use this very method: Compute the IQ data and compute > the magnitude. > > If you want to show why filtering the magnitude is wrong, > plot a real data set and its IQ magnitude in the same plot. > > > I suggested they should filter the complex data, then calculate the > > magnitude. > > Agreed. Taking the magnitude of a complex number is > a non-linear operation, so postpone it to the very end. > Once you take the magnitude you have forefeited the > linear filters (and most if not all DSP methods) for the > downstream processing. > > A depressively common pitfall. > > Rune
Thanks for a clear and helpful explanation. You are right, the method does seem common. Filtering the magnitude gives the 'most pleasing visual result' (these are ultrasound scans). Now all I need to do is to consider what that magnitude filtering does, and why it is 'pleasing', and then do the same thing correctly. :-) My aim at the moment is to make sure that the DSP is done right, then move on to why the various odd methods do work. Chris
On 10 Des, 10:49, Chris Bore <chris.b...@gmail.com> wrote:
> Filtering the magnitude > gives the 'most pleasing visual result' (these are ultrasound scans).
Medical scans? Technical scans?
> Now all I need to do is to consider what that magnitude filtering > does, and why it is 'pleasing', and then do the same thing > correctly. :-) My aim at the moment is to make sure that the DSP is > done right, then move on to why the various odd methods do work.
If this filtering is the absolutely last processing before displaying the image to the human user, be careful. In such situations it is the visual impression as experienced by the human that is important, not whether the processing is formally correct. Nonlinear filters (e.g. median filters) are very common in image processing. I've seen the intensity images (that is, magnitude images) with SubBottom Profiler (SBP) sonars. This is a type of sonar that does the same job as seismology, but at a far smaller scale and with a different user base. The main difference between seismics and SBPs (except for scale) is that the seismic data contain wave form information, and can thus be used to see more details in the image. The downside is that it requires far more from the user to extract that info, as it shows up in terms of subtle refraction and interference patterns. Anyone can learn how to interpret an SBP image in a matter of hours. It would take months and years of training and work to be able to utilize the extra info in seismic images. Of course, while easy to use as is, the SBP intensity images can not be processed further. Which has been frustrating on more than one occasion. Anyway, if you want to go on with other types of processing of these images, you might want to use the linear filter with the 'seismic style' data. In this case, it might be better to branch off before the magnitude filter, so that your clients only gain new functionality, and not loose some old. Rune
On Dec 10, 3:16&#4294967295;am, Chris Bore <chris.b...@gmail.com> wrote:
> I have a client who filters complex data. > > They first calculate the magnitude, then filter that. > > I suggested they should filter the complex data, then calculate the > magnitude. > > The same filter is used in each case, and the filter coefficients are > purely real. > > The results are different, which is not a surprise, but I cannot find > a simple way to explain why this is. Any suggestions would be > welcome. :-)
well, the quickest explanation i can think of is that when only linear processes are involved, commutation of order is fine. but when there are non-linear processes involved, you cannot expect to switch around the order of processes (that are in series) and get the same result. i mean, consider rectifying and low-pass filtering an AC signal (to get magnitude). now switch it around, LPF the AC signal and abs value the result. it won't be the same. r b-j

Chris Bore wrote:

> I have a client who filters complex data. > > They first calculate the magnitude, then filter that. > > I suggested they should filter the complex data, then calculate the > magnitude. > > The same filter is used in each case, and the filter coefficients are > purely real. > > The results are different, which is not a surprise, but I cannot find > a simple way to explain why this is. Any suggestions would be > welcome. :-)
Filtering of the magnitude only results in the nonlinear filter kinda envelope limiter. What is it supposed to do? FWIW you can suggest filtering the phase altogether or separately from the magnitude. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On Dec 10, 6:29&#4294967295;pm, robert bristow-johnson <r...@audioimagination.com>
wrote:
> On Dec 10, 3:16&#4294967295;am, Chris Bore <chris.b...@gmail.com> wrote: > > > I have a client who filters complex data. > > > They first calculate the magnitude, then filter that. > > > I suggested they should filter the complex data, then calculate the > > magnitude. > > > The same filter is used in each case, and the filter coefficients are > > purely real. > > > The results are different, which is not a surprise, but I cannot find > > a simple way to explain why this is. Any suggestions would be > > welcome. :-) > > well, the quickest explanation i can think of is that when only linear > processes are involved, commutation of order is fine. &#4294967295;but when there
Linear operators do not necessarily commute either! Maybe you are thinking of operators that are diagonalized by the same basis, e.g. the Fourier basis. illywhacker;

Chris Bore wrote:

> On 10 Dec, 17:51, Vladimir Vassilevsky <antispam_bo...@hotmail.com> > wrote:
>>Filtering of the magnitude only results in the nonlinear filter kinda >>envelope limiter. What is it supposed to do? > > Well, that is one thing I am trying to figure out.
This is the AGC, as simple as that. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com