# why does my FIR output contain discontinuities?

Started by December 17, 2011
```Hi,

Im working on a simple TX modem task, I need to upsample and pulse filter a
bipolar symbol stream. Im modelling this simple scheme in Matlab.

Ive created a root raised cosine filter using the fdesign toolbox.

I start with a +1/-1 sequence and upsample it by 64, to create an output
symbol duration of T =64ts

I then filter it using my RRC pulse shaping filter ... y = filter( hn_rrc,
1 ,d )

When I look the waveform of y, I see abrupt amplitude discontinuities
occurring at the symbol boundaries.

I just can't find a cause for this?

Any suggestions are greatly appreciated

```
```Hi,

it's common for equiripple-style FIR filter designs. The discontinuity
"manages" the error from truncating the infinite-length impulse response
into the finite number of taps.

If it becomes a problem - for example, for use in a Farrow resampler - one
could use a different design method, such as windowing the ideal impulse
response (see Wikipedia, (root)raised cosine filter).

Now since probably your design is an -optimum- equiripple filter (aka
Parks-Mc Clellan / Remez), the price for getting rid of that outlying
sample is an increased number of taps for otherwise the same performance.
```
```>> I start with a +1/-1 sequence and upsample it by 64, to create an
output
symbol duration of T =64ts

BTW: While it doesn't really matter in Matlab, a more efficient way is:

- interpolate by 2
- pulse shaping filter at rate 2
- interpolate by 32

The reason is that the frequency response of the pulse shaping filter drops
to zero (minus infinite dB) at a rather low frequency. The resulting steep
edge determines the length of the impulse response in absolute time
(seconds). And we'll get that more cheaply at a lower sampling rate.

When interpolation starts with an already oversampled signal at OR=2, there
is a wide "don't care" transition bandwidth, and the interpolator's impulse
response is short.
```
```>>> I start with a +1/-1 sequence and upsample it by 64, to create an
>output
>symbol duration of T =64ts
>
>BTW: While it doesn't really matter in Matlab, a more efficient way is:
>
>- interpolate by 2
>- pulse shaping filter at rate 2
>- interpolate by 32
>
>The reason is that the frequency response of the pulse shaping filter
drops
>to zero (minus infinite dB) at a rather low frequency. The resulting
steep
>edge determines the length of the impulse response in absolute time
>(seconds). And we'll get that more cheaply at a lower sampling rate.
>
>When interpolation starts with an already oversampled signal at OR=2,
there
>is a wide "don't care" transition bandwidth, and the interpolator's
impulse
>response is short.
>

I don't see why you get that.
try this sequence:

data = randsrc(1,1024,[-1 +1]);
h = firrcos(50,.25,.15,1,'rolloff','sqrt');
y1 = filter(h,1,resample(data,2,1));
y2 = resample(y1,32,1);

```
```>>>> I start with a +1/-1 sequence and upsample it by 64, to create an
>>output
>>symbol duration of T =64ts
>>
>>BTW: While it doesn't really matter in Matlab, a more efficient way is:
>>
>>- interpolate by 2
>>- pulse shaping filter at rate 2
>>- interpolate by 32
>>
>>The reason is that the frequency response of the pulse shaping filter
>drops
>>to zero (minus infinite dB) at a rather low frequency. The resulting
>steep
>>edge determines the length of the impulse response in absolute time
>>(seconds). And we'll get that more cheaply at a lower sampling rate.
>>
>>When interpolation starts with an already oversampled signal at OR=2,
>there
>>is a wide "don't care" transition bandwidth, and the interpolator's
>impulse
>>response is short.
>>
>
>I don't see why you get that.
>try this sequence:
>
>data = randsrc(1,1024,[-1 +1]);
>h = firrcos(50,.25,.15,1,'rolloff','sqrt');
>y1 = filter(h,1,resample(data,2,1));
>y2 = resample(y1,32,1);
>
>
>
```
```I should have said:

data = randsrc(1,1024,[-1 +1]);
h = firrcos(50,.25,.15,1,'rolloff','sqrt');
y1 = filter(h,1,upsample(data,2,1));     %not resample
y2 = resample(y1,32,1);

```
```"upsample" before the pulse shaping filter is correct (insert one zero
after every sample). The pulse shaping filter needs the alias from the
symbol rate upwards, at least up to (1+alpha)*symbolrate.
If it's still broken, it might require some detective work into what
exactly some toolbox functions are doing.
```
```On Sat, 17 Dec 2011 03:21:38 -0600, mnentwig wrote:

> Hi,
>
> it's common for equiripple-style FIR filter designs. The discontinuity
> "manages" the error from truncating the infinite-length impulse response
> into the finite number of taps.
>
> If it becomes a problem - for example, for use in a Farrow resampler -
> one could use a different design method, such as windowing the ideal
> impulse response (see Wikipedia, (root)raised cosine filter).
>
> Now since probably your design is an -optimum- equiripple filter (aka
> Parks-Mc Clellan / Remez), the price for getting rid of that outlying
> sample is an increased number of taps for otherwise the same
> performance.

Eh?  The OP is talking about discontinuities in his filter output, not in
his filter tap profile.

He also comments that he's using a raised cosine filter, which (should!)
go to zero at the ends.

So unless he's seeing teeny tiny discontinuities that are just from
strong impulses, or slope discontinuities or something, I don't see why
he's seeing discontinuities, either.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
```
```Hi,
If there is a discontinuity in the impulse response, it will show as a
discontinuity in the sample stream, when one sample drops out of the delay
line and a new one enters.
A root-raised cosine filter, if designed with equiripple methods, will show
the discontinuity, just like any other equiripple filter.

But, of course I'm only guessing what exactly is broken, and it may turn
out that I'm guessing wrong.

```
```On 12/18/11 12:44 PM, mnentwig wrote:
> Hi,
> If there is a discontinuity in the impulse response, it will show as a
> discontinuity in the sample stream, when one sample drops out of the delay
> line and a new one enters.

*if* you have a discontinuity in that stream.

it doesn't matter how nasty the impulse response looks, if it's a nice,
smooth sinusoid going in, a nice smooth sinusoid of the same frequency
will come out.

--

r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."

```