# Resampling and Filtering Process

Started by January 5, 2011
```Hi,

i'm designing a resampling process that implement a FIR filter. The
resampling rate is 3/2 and the FIR filter has 73 taps , so the step of
processes is

1. Upsampling by 3
2. Filtering with 73-taps filter
3. Downsampling by 2

Let's say i have 2000 array of input signal, so the output of resampling
must be 3000 of array signal. But if i follow the step

1. Upsampling by 3 , (number of array = 2 x 3000 = 6000)
2. Filtering with 73-taps filter (number of array = 6000 + 72 = 6072)
3. Downsampling by 2 (number of array = 6072 : 2 = 3036)

Is the process correct?
The final number of array is 3036. How do i get exact number of 3000 array
signal? Which array should i throw away?

Thanks

```
```On Jan 5, 6:23&#2013266080;am, "hamkanen" <hamkanen@n_o_s_p_a_m.gmail.com> wrote:
> Hi,
>
> i'm designing a resampling process that implement a FIR filter. The
> resampling rate is 3/2 and the FIR filter has 73 taps , so the step of
> processes is
>
> 1. Upsampling by 3
> 2. Filtering with 73-taps filter
> 3. Downsampling by 2
>
> Let's say i have 2000 array of input signal, so the output of resampling
> must be 3000 of array signal. But if i follow the step
>
> 1. Upsampling by 3 , (number of array = 2 x 3000 = 6000)
> 2. Filtering with 73-taps filter (number of array = 6000 + 72 = 6072)
> 3. Downsampling by 2 (number of array = 6072 : 2 = 3036)
>
> Is the process correct?
> The final number of array is 3036. How do i get exact number of 3000 array
> signal? Which array should i throw away?
>
> Thanks

The extra samples are due to the transients (i.e. delay) of your
filter. This is normal. If you want exactly 3000 samples, then which
ones you keep depends upon what you're looking for. If you only care
about the steady state output of the filter, then keep the last 3000.
If you're interested in looking at the response of the filter as the
signal starts to enter it, then keep an earlier set of samples. If
this is a streaming application where you will continue to insert
samples into the filter, then you should be fine; after the initial
transient, you will get 3000 samples out for every 2000 that you put
in.

Jason
```
```On Wed, 5 Jan 2011 06:11:51 -0800 (PST), Jason <cincydsp@gmail.com>
wrote:

[Snipped by Lyons]

>The extra samples are due to the transients (i.e. delay) of your
>filter. This is normal. If you want exactly 3000 samples, then which
>ones you keep depends upon what you're looking for. If you only care
>about the steady state output of the filter, then keep the last 3000.
>If you're interested in looking at the response of the filter as the
>signal starts to enter it, then keep an earlier set of samples. If
>this is a streaming application where you will continue to insert
>samples into the filter, then you should be fine; after the initial
>transient, you will get 3000 samples out for every 2000 that you put
>in.
>
>Jason

Hi Jason,
You're right.  hamkanen needs to (1) learn about
the "beginning" and "ending" transient responses of
tapped-delay line FIR filters.  He should (2) also
pay close attention to how his FIR filter software
operates.   For example Matlab's "conv()" and
"filter()" commands should produce the same FIR
filter output result, but they don't.  That "filter()"
command deletes the "ending" transient resonse of
a FIR filter.

[-Rick-]
```
```
Hi, Jason, Rick and Jerry, thanks for your responses
Since the task is resampling, so i'll need output to be same shape with
input signal. Because there are "beginning" and "ending" transient response
, so i think to remove it. So, here is my scheme

i try one period of sinusoidal as input signal

1. Upsampling by 3 , (number of array = 2 x 3000 = 6000)
2. Filtering (with conv()) with 73-taps filter (number of array = 6000 + 72
= 6072)
3. Remove 36 sample in the beginning and ending --> 6072 - 36 -36 =6000
4. Downsampling by 2 (number of array = 6000 : 2 = 3000)

the output has same shape with input signal with sample rate changing. Is
the transient in beginning and the ending, always half of number of FIR
coeefficient?
```
```On Jan 7, 2:42&#2013266080;am, "hamkanen" <hamkanen@n_o_s_p_a_m.gmail.com> wrote:
> Hi, Jason, Rick and Jerry, thanks for your responses
> Since the task is resampling, so i'll need output to be same shape with
> input signal. Because there are "beginning" and "ending" transient response
> , so i think to remove it. So, here is my scheme
>
> i try one period of sinusoidal as input signal
>
> 1. Upsampling by 3 , (number of array = 2 x 3000 = 6000)
> 2. Filtering (with conv()) with 73-taps filter (number of array = 6000 + 72
> = 6072)
> 3. Remove 36 sample in the beginning and ending --> 6072 - 36 -36 =6000
> 4. Downsampling by 2 (number of array = 6000 : 2 = 3000)
>
> the output has same shape with input signal with sample rate changing. Is
> the transient in beginning and the ending, always half of number of FIR
> coeefficient?

If you use a linear-phase (i.e. symmetric) FIR filter, then yes, its
delay is half of the filter order.

Jason
```