Reply by SG August 28, 20172017-08-28
Am Sonntag, 27. August 2017 15:23:01 UTC+2 schrieb fl:
> [...] > Now, I cannot explain a spectral line in the resampling test. The system is > a 40 MSPS input, to a 10 MHz low pass filter (stop band is 12 MHz). Then, > it is 5X interpolation, (2nd LP filter) low pass to (pi/8-sigbandwidth), 8X > decimation in the end. > > I have two questions in the simulation. > > 1. The 2nd LP filter has an attenuation -86 dB after the stop band.
Has it really? (see below)
> I use 160K length sine wave in the test. When the sine wave is around 10 MHz, > there is an obvious 5 MHz component (spurious?) with magnitude -70 dB. I guess > it is generated by the test process, not a design fault. I once read an > article talking some techniques explaining/avoiding things like this, but > I cannot find that article now.
Seems like the 2nd lowpass filter isn't able to suppress the first image frequency enough. The 10 MHz appears at 30, 50, 70 and 90 MHz after zero stuffing. After subsampling by factor 8, you have a new sampling rate of 25 MHz. At that sampling rate the 30 MHz gets mirrored down to 5 MHz. Ideally, the 30 MHz would be filtered out by your 2nd LP filter. But it seems, it didn't.
> 2. A Hanning window is used on the filtered data before FFT. There is DC > component -56 dB below the fundamental sine frequency magnitude. Where is > this error from? It is the same when I change the test data length from > 160K to 640K.
This could be aliasing, too. The second image frequency of 10 MHz is 50 MHz which gets mirrored down to 0 Hz if you sample it at 25 MHz. This suggests, that your 2nd lowpass filter didn't suppress 50 MHz enough. Assuming that the 1st LP filter has a very steep transition band of 2 MHz width (stop band starting at 12 MHz), the 2nd LP filter should have a stopband that starts at 40-12=28 MHz to suppress the image frequencies of the 0-12 MHz band. Try this for your 2nd LP filter: lp = firls(64,[0 10 28 20*5]./(20*5),[1 1 0 0],[1 1000]); [h,f] = freqz(lp); plot(f./pi*20*5,20*log10(abs(h))); ...and tweak the parameters to your requirements.
> Thank you so much.
HTH, sg
Reply by fl August 27, 20172017-08-27
Hi,

Thank all of you for replying to my previous post on filter impulse response.
One of the replies said to directly calculate the fir coef as the original
filter. I considered this method. The only problem is too time consuming.
As it is not a general FIR design, I have to find the background information
to write the code from the bottom. OK. I have solved the problem with all of
your inputs.

Now, I cannot explain a spectral line in the resampling test. The system is
a 40 MSPS input, to a 10 MHz low pass filter (stop band is 12 MHz). Then,
it is 5X interpolation, (2nd LP filter) low pass to (pi/8-sigbandwidth), 8X 
decimation in the end.

I have two questions in the simulation.

1. The 2nd LP filter has an attenuation -86 dB after the stop band.
I use 160K length sine wave in the test. When the sine wave is around 10 MHz,
there is an obvious 5 MHz component (spurious?) with magnitude -70 dB. I guess
it is generated by the test process, not a design fault. I once read an
article talking some techniques explaining/avoiding things like this, but
I cannot find that article now. 

2. A Hanning window is used on the filtered data before FFT. There is DC 
component -56 dB below the fundamental sine frequency magnitude. Where is 
this error from? It is the same when I change the test data length from
160K to 640K.


Thank you so much.