Reply by Tim Wescott February 6, 20132013-02-06
On Wed, 06 Feb 2013 18:12:26 -0800, yweesoon wrote:

> Hi, > > I did the simulation again with the following specifications using > ‘sptool’ of Matlab: 1) Fs=25MHz, > 2) fstop1=2.0MHz, > 3) fpasss1=2.5MHz, > 4) fpass2=3.5MHz, > 5) fstop2=4.0MHz. > 6) Astop1=80dB, Apass=1dB, Astop2=80dB. 7) IIR Butterworth filter. > > ‘sptool’ filter design tool gives me a filter of the following specs: - > Structure: Direct form II, 2nd-order section - Order: 32 > - Sections: 16 > - Stable: Yes > > Then I imported a sequence of 3MHz pure tone signal from Matlab’s > workspace onto ‘sptool’, and applied the designed 32-order filter onto > the pure tone signal. I observed that there is ringing at the beginning > of the filtered signal and it eventually dies down. As I want to learn > how this transient ringing effect will have on narrow band filter, I > reduce the passband of the filter further to the followings: 1) > Fs=25MHz, > 2) fstop1=2.99MHz, > 3) fpasss1=2.999MHz, > 4) fpass2=3.001MHz, > 5) fstop2=3.01MHz. > 6) Astop1=80dB, Apass=1dB, Astop2=80dB. 7) IIR Butterworth filter. > > > ‘sptool’ filter design tool then gives me a filter of the following > specs: - Structure: Direct form II, 2nd-order section - Order: 10 > - Sections: 5 > - Stable: Yes > > Again, I applied this filter onto the 3MHz pure tone signal, and this > time I observed that there is much strong ringing effect at the > beginning of the filtered signal and it lasted much longer time > (probably 1.5ms) with higher amplitude fluctuations (20% at highest > amplitude). > > May I know what the cause of this transient ringing effect is? And how > can it be removed for this narrow bandpass filter?
The cause of the ringing is that the filter bandwidth is narrow. And while there may be details that you can change that will help things, the only way that you can significantly reduce it is to open up the filter. Basically, the reason that this effect happens is because your tone starts and stops. A sinusoid that lasts forever exists at one pure frequency. But a sinusoid that is zero up to some time, then starts up, has a spectrum that extends to infinity. When you run that sinusoid through a narrow filter, you see the transient. A filter could probably be designed to at least have an output that smoothly rose to its maximum amplitude, without ringing. But you'd need more sections, and the filter couldn't have as flat a bandpass response. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by February 6, 20132013-02-06
Hi,

I did the simulation again with the following specifications using �sptool� of Matlab:
1) Fs=25MHz, 
2) fstop1=2.0MHz, 
3) fpasss1=2.5MHz, 
4) fpass2=3.5MHz, 
5) fstop2=4.0MHz. 
6) Astop1=80dB, Apass=1dB, Astop2=80dB.
7) IIR Butterworth filter. 

�sptool� filter design tool gives me a filter of the following specs:
- Structure: Direct form II, 2nd-order section
- Order: 32
- Sections: 16
- Stable: Yes

Then I imported a sequence of 3MHz pure tone signal from Matlab�s workspace onto �sptool�, and applied the designed 32-order filter onto the pure tone signal. I observed that there is ringing at the beginning of the filtered signal and it eventually dies down. As I want to learn how this transient ringing effect will have on narrow band filter, I reduce the passband of the filter further to the followings:
1) Fs=25MHz, 
2) fstop1=2.99MHz, 
3) fpasss1=2.999MHz, 
4) fpass2=3.001MHz, 
5) fstop2=3.01MHz. 
6) Astop1=80dB, Apass=1dB, Astop2=80dB.
7) IIR Butterworth filter. 


�sptool� filter design tool then gives me a filter of the following specs:
- Structure: Direct form II, 2nd-order section
- Order: 10
- Sections: 5
- Stable: Yes

Again, I applied this filter onto the 3MHz pure tone signal, and this time I observed that there is much strong ringing effect at the beginning of the filtered signal and it lasted much longer time (probably 1.5ms) with higher amplitude fluctuations (20% at highest amplitude).

May I know what the cause of this transient ringing effect is?
And how can it be removed for this narrow bandpass filter?

Thank you.
Reply by February 6, 20132013-02-06
On Thursday, February 7, 2013 2:06:00 AM UTC+8, Randy Yates wrote:
> Tim Wescott <tim@seemywebsite.please> writes: > > > > > On Wed, 06 Feb 2013 11:29:18 -0500, Randy Yates wrote: > > > > > >> yweesoon@gmail.com writes: > > >> > > >>> I designed a bandpass filter under sptool of Matlab with the following > > >>> specs: > > >>> 1) Fs=25MHz, > > >>> 2) fstop1=20MHz, > > >>> 3) fpasss1=25MHz, > > >>> 4) fpass2=30MHz, > > >>> 5) fstop2=40MHz. > > >>> 6) IIR Butterworth filter. > > >> > > >> I may be missing something here, but how can you have stop and passbands > > >> that are > Fs / 2? Are you trying to do bandpass sampling? Does Matlab's > > >> sptool support bandpass sampling specifications? > > > > > > I missed that completely. > > > > Thank you, thank you, thank you, Tim. With all these smart people in > > this group, being the only one to notice such a basic problem had me > > worried I had lost it! > > -- > > Randy Yates > > Digital Signal Labs > > http://www.digitalsignallabs.com
I want to apologise to those who took the time to help me in answering my question. These include Robert Miles, Rick Lyons, Anand P. Paralkar, Tim Wescott, Randy Yates! The reason is reason I made terrible typo errors in my question regarding the specification. It should be as follows: 1) Fs=25MHz, 2) fstop1=2.0MHz, 3) fpasss1=2.5MHz, 4) fpass2=3.0MHz, 5) fstop2=4.0MHz. 6) IIR Butterworth filter. Please accept my apolpgize! Sorry about that!
Reply by Randy Yates February 6, 20132013-02-06
Tim Wescott <tim@seemywebsite.please> writes:

> On Wed, 06 Feb 2013 11:29:18 -0500, Randy Yates wrote: > >> yweesoon@gmail.com writes: >> >>> I designed a bandpass filter under sptool of Matlab with the following >>> specs: >>> 1) Fs=25MHz, >>> 2) fstop1=20MHz, >>> 3) fpasss1=25MHz, >>> 4) fpass2=30MHz, >>> 5) fstop2=40MHz. >>> 6) IIR Butterworth filter. >> >> I may be missing something here, but how can you have stop and passbands >> that are > Fs / 2? Are you trying to do bandpass sampling? Does Matlab's >> sptool support bandpass sampling specifications? > > I missed that completely.
Thank you, thank you, thank you, Tim. With all these smart people in this group, being the only one to notice such a basic problem had me worried I had lost it! -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by Tim Wescott February 6, 20132013-02-06
On Wed, 06 Feb 2013 11:29:18 -0500, Randy Yates wrote:

> yweesoon@gmail.com writes: > >> I designed a bandpass filter under sptool of Matlab with the following >> specs: >> 1) Fs=25MHz, >> 2) fstop1=20MHz, >> 3) fpasss1=25MHz, >> 4) fpass2=30MHz, >> 5) fstop2=40MHz. >> 6) IIR Butterworth filter. > > I may be missing something here, but how can you have stop and passbands > that are > Fs / 2? Are you trying to do bandpass sampling? Does Matlab's > sptool support bandpass sampling specifications?
I missed that completely. Given that the OP is adamant that 3MHz (yes, 3.0MHz) is in the passband, perhaps he's off by a factor of 10 on his filter numbers? -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by Randy Yates February 6, 20132013-02-06
yweesoon@gmail.com writes:

> I designed a bandpass filter under sptool of Matlab with the following specs: > 1) Fs=25MHz, > 2) fstop1=20MHz, > 3) fpasss1=25MHz, > 4) fpass2=30MHz, > 5) fstop2=40MHz. > 6) IIR Butterworth filter.
I may be missing something here, but how can you have stop and passbands that are > Fs / 2? Are you trying to do bandpass sampling? Does Matlab's sptool support bandpass sampling specifications? -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by Tim Wescott February 6, 20132013-02-06
On Tue, 05 Feb 2013 23:38:42 -0800, yweesoon wrote:

> On Wednesday, February 6, 2013 3:07:45 PM UTC+8, Rick Lyons wrote: >> On Tue, 5 Feb 2013 22:10:40 -0800 (PST), yweesoon@gmail.com wrote: >> >> >> >> >I designed a bandpass filter under sptool of Matlab with the following >> >specs: >> >> >1) Fs=25MHz, >> >> >2) fstop1=20MHz, >> >> >3) fpasss1=25MHz, >> >> >4) fpass2=30MHz, >> >> >5) fstop2=40MHz. >> >> >6) IIR Butterworth filter. >> >> >> > >> >It gives me an IIR filter of 32-order. After that, >> >> Hi, >> >> Wow. A 32-order IIR filter is *VERY* >> >> high order filter. >> >> >> >> >I generated a sequence of >> >> >single frequency signal of 3MHz and let this signal being filtered by >> >the >> >> >designed IIR filter. >> >> >> >> You say you generated a pure tone whose frequency is >> >> 3 MHz. Is the "3" a typo? Do you really mean 3 MHz? >> >> > Yes, I mean 3 MHz pure tone frequency. > > >> >> Your words are a bit incorrect. You cannot "filter" a pure >> >> tone. You can filter a signal containing many tones of >> >> different frequencies, but you cannot filter a single >> >> tone. What you should say is, "I applied my 3 MHz tone >> >> to the input of a filter." >> >> > Yes, I understand what you meant by cannot filter the pure tone > frequency of 3 MHz signal. My purpose of doing this is for studying the > of the IIR filter characteristic. I want to ensure that a pure tone > signal that falls within the passband of an IIR filter after passing > through it will only suffer delay and not other thing. However, I saw > there is a variation in the output amplitude and this surprise me. > Probably this example is still no so observe, I will give another > example in a separate posting, thank you.
Your stated passband is from 25MHz to 30MHz. 3MHz is way, way lower than your stated passband. If you were trying to run a 30MHz signal through the filter and everything else were working correctly I'd suspect ringing, which ought to die down. Did you implement the filter as 16 2nd-order filters in cascade, or one humongous 32nd order filter? If you did the humongous one, then chances are exceedingly high that you are running into numerical difficulties. In fact, if you did the humongous one I'm surprised that you're not asking why your filter output exploded, 'cause I'd expect that those numerical difficulties would include instability in such a filter. Even if you're running 16 2nd-order filters, I would expect so much attenuation at 3MHz that you'd be running into round-off errors, and seeing numerical "scrud" as a consequence. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by Anand P. Paralkar February 6, 20132013-02-06
On 06-02-2013 11:40, yweesoon@gmail.com wrote:
> I designed a bandpass filter under sptool of Matlab with the following specs: > 1) Fs=25MHz, > 2) fstop1=20MHz, > 3) fpasss1=25MHz, > 4) fpass2=30MHz, > 5) fstop2=40MHz. > 6) IIR Butterworth filter. > > It gives me an IIR filter of 32-order. After that, I generated a sequence of single frequency signal of 3MHz and let this signal being filtered by the designed IIR filter. When I observed the flter's output signal, there are small variation at its amplitude. > > I understand that IIR filter has non-linear phase characteristic. Signal of different frequency when passes through it will suffer delay by different amount. And therefore, if a signal that is composed of more than one frequency component (frequency that is within the passband of the filter) when passes through the IIR filter, the output signal will not look the same as the input. > > But in my case, why distortion exists when the signal of single frequency component passing through the IIR filter?
I think what you mention as "small variation at its amplitude" is what you are calling "distortion" later-on. I would suggest that you do not call this "distortion" when you are asking people, because distortion typically refers to a change in the wave shape. Here's what I think you should do: 1. Plot the gain magnitude versus frequency characteristics of your filter. 2. Multiply the value of the gain magnitude of the filter at 3 MHz by the amplitude of the input signal. 3. The value so obtained should be the same as the "observed" value. If these two values match, I think you are fine. If they don't, you need to check whether the pass band gain of the filter is as per your expectation. And also, it would help if you send some more details (code, plots etc.). All the best, Anand
Reply by February 6, 20132013-02-06
On Wednesday, February 6, 2013 3:07:45 PM UTC+8, Rick Lyons wrote:
> On Tue, 5 Feb 2013 22:10:40 -0800 (PST), yweesoon@gmail.com wrote: > > > > >I designed a bandpass filter under sptool of Matlab with the following specs: > > >1) Fs=25MHz, > > >2) fstop1=20MHz, > > >3) fpasss1=25MHz, > > >4) fpass2=30MHz, > > >5) fstop2=40MHz. > > >6) IIR Butterworth filter. > > > > > >It gives me an IIR filter of 32-order. After that, > > Hi, > > Wow. A 32-order IIR filter is *VERY* > > high order filter. > > > > >I generated a sequence of > > >single frequency signal of 3MHz and let this signal being filtered by the > > >designed IIR filter. > > > > You say you generated a pure tone whose frequency is > > 3 MHz. Is the "3" a typo? Do you really mean 3 MHz? >
Yes, I mean 3 MHz pure tone frequency.
> > > Your words are a bit incorrect. You cannot "filter" a pure > > tone. You can filter a signal containing many tones of > > different frequencies, but you cannot filter a single > > tone. What you should say is, "I applied my 3 MHz tone > > to the input of a filter." >
Yes, I understand what you meant by cannot filter the pure tone frequency of 3 MHz signal. My purpose of doing this is for studying the of the IIR filter characteristic. I want to ensure that a pure tone signal that falls within the passband of an IIR filter after passing through it will only suffer delay and not other thing. However, I saw there is a variation in the output amplitude and this surprise me. Probably this example is still no so observe, I will give another example in a separate posting, thank you.
> > > The output of the filter > > will also be a 3 Mhz tone. The 3 MHz output tone will > > have a different peak amplitude compared to the peak > > amplitude of the input 3 Mhz tone, and the 3 Mhz output > > tone will be shifted in phase relative to the phase of > > the 3 MHz input tone. > > > > > > >When I observed the flter's output signal, there are small variation at > > >its amplitude. > > > > What does a "small variation at its amplitude" mean? > > > > >I understand that IIR filter has non-linear phase characteristic. Signal of > > >different frequency when passes through it will suffer delay by different amount. > > >And therefore, if a signal that is composed of more than one frequency component > > >(frequency that is within the passband of the filter) when passes through the IIR > > >filter, the output signal will not look the same as the input. > > > > That is correct. > > > > >But in my case, why distortion exists when the signal of single frequency > > >component passing through the IIR filter? > > > > What does the word "distortion" mean? > > > > If you gives us more specific details I imagine > > someone here can help you. > > > > [-Rick-]
Reply by Rick Lyons February 6, 20132013-02-06
On Tue, 5 Feb 2013 22:10:40 -0800 (PST), yweesoon@gmail.com wrote:

>I designed a bandpass filter under sptool of Matlab with the following specs: >1) Fs=25MHz, >2) fstop1=20MHz, >3) fpasss1=25MHz, >4) fpass2=30MHz, >5) fstop2=40MHz. >6) IIR Butterworth filter. > >It gives me an IIR filter of 32-order. After that,
Hi, Wow. A 32-order IIR filter is *VERY* high order filter.
>I generated a sequence of >single frequency signal of 3MHz and let this signal being filtered by the >designed IIR filter.
You say you generated a pure tone whose frequency is 3 MHz. Is the "3" a typo? Do you really mean 3 MHz? Your words are a bit incorrect. You cannot "filter" a pure tone. You can filter a signal containing many tones of different frequencies, but you cannot filter a single tone. What you should say is, "I applied my 3 MHz tone to the input of a filter." The output of the filter will also be a 3 Mhz tone. The 3 MHz output tone will have a different peak amplitude compared to the peak amplitude of the input 3 Mhz tone, and the 3 Mhz output tone will be shifted in phase relative to the phase of the 3 MHz input tone.
>When I observed the flter's output signal, there are small variation at >its amplitude.
What does a "small variation at its amplitude" mean?
>I understand that IIR filter has non-linear phase characteristic. Signal of >different frequency when passes through it will suffer delay by different amount. >And therefore, if a signal that is composed of more than one frequency component >(frequency that is within the passband of the filter) when passes through the IIR >filter, the output signal will not look the same as the input.
That is correct.
>But in my case, why distortion exists when the signal of single frequency >component passing through the IIR filter?
What does the word "distortion" mean? If you gives us more specific details I imagine someone here can help you. [-Rick-]