Hi , I'm new to multirate filters. I am trying to implement an interp by 3 and decim by 5 multirate filter. Lets say i have 40 taps in the filter. I have 5 sub-filters with 8 taps each. In the 1st clock cycle i input 2 samples to sub-filters 1 and 4 In the 2nd clock cycle i input 2 new samples to sub-filters 2 and 5 In the 3 clock cycle i input 1 new sample to sub-filters 3 So, 5 samples in and 3 samples out should do the job. Now, to factor in the interp by 3(insertion of 2 zeros), I just shift the values in clocks 1,2 and 3 . When i test the impulse response of my filter and compare with the quick matlab script(interp by 3-->filter--->decim by 5), It works. However when i have random data at the input , it does not work. How do i ensure that i'm calculating the correct inner products in the 3 clocks? I think this is my problem. Any suggestions or articles(pointers) is appreciated. Thanx in advance, Chivak

# multirate resampling implementation

Started by ●May 8, 2009

Reply by ●May 11, 20092009-05-11

>Hi , > > I'm new to multirate filters. > I am trying to implement an interp by 3 and decim by 5 multiratefilter.> > Lets say i have 40 taps in the filter. > I have 5 sub-filters with 8 taps each. > > In the 1st clock cycle i input 2 samples to sub-filters 1 and 4 >In the 2nd clock cycle i input 2 new samples to sub-filters 2 and 5 >In the 3 clock cycle i input 1 new sample to sub-filters 3 > > So, 5 samples in and 3 samples out should do the job. > >Now, to factor in the interp by 3(insertion of 2 zeros), I just shiftthe> > values in clocks 1,2 and 3 . > > When i test the impulse response of my filter and compare with thequick> matlab script(interp by 3-->filter--->decim by 5), It works. > > However when i have random data at the input , it does not work. > How do i ensure that i'm calculating the correct inner products in the3>clocks? I think this is my problem. > > Any suggestions or articles(pointers) is appreciated. > > >Thanx in advance, > Chivak > > > >Hi Chivak, One thing you can do is try to simplify things as much as possible before worrying about making the implementation efficient. Get the interpolator tested and working first, and then apply the decimation. Make sure you design your filter at the correct sampling rate (3 times your original sampling rate). Then do a really straightforward implementation where you stuff two zeroes between each input sample, and apply the entire filter to the output. Create some test signals, for example a few different frequencies of sine waves. Make sure the output you get is the same as the input, but at the higher sampling rate. Then apply the decimation (by only keeping every 5th sample), and again, make sure the output is what you expect. When everything is working, write the test output for each test sequence to a file for later testing. Then you can begin making your implementation more efficient. Start by eliminating the insertion of the zeroes in the input, and instead apply every third tap of your filter. If your original filter was 30 taps, you should have 3 different "phases" of the original filter with 10 taps. Test with your test sequences, and make sure the output matches the expected output. Once that is working, you can make things even quicker, since only 1 out of every 5 outputs that are being calculated will actually be kept. So you need to determine the pattern of which of the three filters to apply, and how to align the filter with the input to generate each output. I hope that helps, Shawn Stevenson Embedded Systems Developer http://www.linkedin.com/in/sestevenson