>> and upsample it by 64, to create an output symbol duration of T =64ts >> I then filter itmy guess is, there is a discontinuity at the end of the impulse response, the input signal stream is [s1 0 0 0 0.... s2 0 0 0 0 ... s3 0 0 0 0 ...] and that's how it ends up in the output. Anyway, just a theory...

# why does my FIR output contain discontinuities?

Started by ●December 17, 2011

Reply by ●December 18, 20112011-12-18

Reply by ●December 19, 20112011-12-19

Hi all, Thanks for the comments...apologies for the late feedback.. To re-iterate, the discontinuities Im seeing are in the output of my filter. I should add another "key" piece of information: The Matlab raised cosine design methods all return an even ordered filter, and thus odd number of taps. The filter structure Im loading the coefficients into is already implemented in an FPGA, and expects an even number of taps. Thus, I have the problem - How do I extract an even number of taps for my filter implementation from an odd number of designed coefficients. I've tried dropping a coefficient from the start, middle and end of the impulse response, but each results in the same discontinuities in the output of my model of the hardware filter. Also, while the impulse response approaches zero and the ends, it doesnt quite get there!

Reply by ●December 19, 20112011-12-19

On 12/19/2011 12:46 PM, amlangford wrote:> Hi all, > > Thanks for the comments...apologies for the late feedback.. > > To re-iterate, the discontinuities Im seeing are in the output of my > filter. > > I should add another "key" piece of information: The Matlab raised cosine > design methods all return an even ordered filter, and thus odd number of > taps. The filter structure Im loading the coefficients into is already > implemented in an FPGA, and expects an even number of taps. > > Thus, I have the problem - How do I extract an even number of taps for my > filter implementation from an odd number of designed coefficients. > > I've tried dropping a coefficient from the start, middle and end of the > impulse response, but each results in the same discontinuities in the > output of my model of the hardware filter.Design a filter with an even number of taps. If you don't have a canned routine to do that, roll your own. FIR filters are generally end-to-end symmetric. Removing any tap from a filter with an even number of them breaks that symmetry.> Also, while the impulse response approaches zero and the ends, it doesnt > quite get there!I generally design filters that way when I use windowing. By designing an N+2 tap filter that goes to zero at the ends, I can implement with only N taps, with a miniscule improvement in performance. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●December 19, 20112011-12-19

Jerry, there's gotta be something that the OP is doing wrong, if he tests his filter with a sufficiently smooth input (we can get into quantizing that parameter later), it doesn't matter how his/her impulse response looks, he/she should get a smooth output. if there are discontinuities, either he has to have discontinuities in *both* h[n] and x[n] (if a point in the spectrum of H[k] and X[k] is not zero, then *both* H[k] and X[k] are non-zero for that value of k. for there to be discontinuities in y[k], then there is some high-frequency contect in Y[k] and then also in both X[k] and H[k] at those high frequencies. so maybe there's an error in the code that is generating the discontinuities or maybe the OP has discontinuities in both input and impulse response. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." On 12/19/11 1:39 PM, Jerry Avins wrote:> On 12/19/2011 12:46 PM, amlangford wrote: >> Hi all, >> >> Thanks for the comments...apologies for the late feedback.. >> >> To re-iterate, the discontinuities Im seeing are in the output of my >> filter. >> >> I should add another "key" piece of information: The Matlab raised cosine >> design methods all return an even ordered filter, and thus odd number of >> taps. The filter structure Im loading the coefficients into is already >> implemented in an FPGA, and expects an even number of taps. >> >> Thus, I have the problem - How do I extract an even number of taps for my >> filter implementation from an odd number of designed coefficients. >> >> I've tried dropping a coefficient from the start, middle and end of the >> impulse response, but each results in the same discontinuities in the >> output of my model of the hardware filter. > > Design a filter with an even number of taps. If you don't have a canned > routine to do that, roll your own. FIR filters are generally end-to-end > symmetric. Removing any tap from a filter with an even number of them > breaks that symmetry. > >> Also, while the impulse response approaches zero and the ends, it doesnt >> quite get there! > > I generally design filters that way when I use windowing. By designing > an N+2 tap filter that goes to zero at the ends, I can implement with > only N taps, with a miniscule improvement in performance. > > Jerry

Reply by ●December 19, 20112011-12-19

On Mon, 19 Dec 2011 11:46:07 -0600, "amlangford" <amlangford31@n_o_s_p_a_m.hotmail.com> wrote:>Hi all, > >Thanks for the comments...apologies for the late feedback.. > >To re-iterate, the discontinuities Im seeing are in the output of my >filter. > >I should add another "key" piece of information: The Matlab raised cosine >design methods all return an even ordered filter, and thus odd number of >taps. The filter structure Im loading the coefficients into is already >implemented in an FPGA, and expects an even number of taps. > >Thus, I have the problem - How do I extract an even number of taps for my >filter implementation from an odd number of designed coefficients.Just add a coefficient at one of the ends set zero so that there's an even number of taps. In other words, load your full odd-tapped coefficient set and set the remaining coefficient (at whichever end) to zero.>I've tried dropping a coefficient from the start, middle and end of the >impulse response, but each results in the same discontinuities in the >output of my model of the hardware filter.That's probably contributing to the problem. Dropping a coefficient from the middle will likely significantly change the frequency response of the filter.>Also, while the impulse response approaches zero and the ends, it doesnt >quite get there!That's normal. I agree with rb-j that if you're seeing discontinuities in the output with continuous inputs you probably have a significant error somewhere. Eric Jacobsen Anchor Hill Communications www.anchorhill.com

Reply by ●December 19, 20112011-12-19

On 12/19/2011 1:58 PM, robert bristow-johnson wrote:> > Jerry, there's gotta be something that the OP is doing wrong, if he > tests his filter with a sufficiently smooth input (we can get into > quantizing that parameter later), it doesn't matter how his/her impulse > response looks, he/she should get a smooth output. if there are > discontinuities, either he has to have discontinuities in *both* h[n] > and x[n] (if a point in the spectrum of H[k] and X[k] is not zero, then > *both* H[k] and X[k] are non-zero for that value of k. for there to be > discontinuities in y[k], then there is some high-frequency contect in > Y[k] and then also in both X[k] and H[k] at those high frequencies. > > so maybe there's an error in the code that is generating the > discontinuities or maybe the OP has discontinuities in both input and > impulse response.Robert, You pointed that out a few posts back, and if it wasn't obvious before then, it has to be now. I was addressing another problem, maybe less important. After you remove any one tap from a palindrome-symmetric filter, it's not symmetrical any more. We know that the phase gets screwed up, and the frequency response will be off too. How much it will change depends on the original impulse response. If the original coefficients alternate sign, expect something drastic. Amlangford, If you must use Matlab's design, call for a filter that is one tap shorter than the structure to hold it and append a zero tap at the end. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●December 19, 20112011-12-19

Gentlemen ... thank you all for your suggestions. I have a few things to try in Matlab now. Ill post back here with results. Many thanks, Adrian

Reply by ●December 19, 20112011-12-19

On 12/19/2011 3:18 PM, Eric Jacobsen wrote: ...> Just add a coefficient at one of the ends set zero so that there's an > even number of taps. In other words, load your full odd-tapped > coefficient set and set the remaining coefficient (at whichever end) > to zero.The "far" end gives lower latency. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●December 20, 20112011-12-20

>On Mon, 19 Dec 2011 11:46:07 -0600, "amlangford" ><amlangford31@n_o_s_p_a_m.hotmail.com> wrote: > >>Hi all, >> >>Thanks for the comments...apologies for the late feedback.. >> >>To re-iterate, the discontinuities Im seeing are in the output of my >>filter. >> >>I should add another "key" piece of information: The Matlab raisedcosine>>design methods all return an even ordered filter, and thus odd number of >>taps. The filter structure Im loading the coefficients into is already >>implemented in an FPGA, and expects an even number of taps. >> >>Thus, I have the problem - How do I extract an even number of taps formy>>filter implementation from an odd number of designed coefficients. > >Just add a coefficient at one of the ends set zero so that there's an >even number of taps. In other words, load your full odd-tapped >coefficient set and set the remaining coefficient (at whichever end) >to zero.While true, adding a zero(or zeros) at one end gives equivalent output possibly with output delay difference, but any filter can be visualised as having zero(s) at one or other end. I think if your fpga structure has even number of coeffs then it is meant to have it for some good reason e.g. to obtain two equivalent polyphases if read one opposite the other. Adding a zero in this case will not help the purpose. You will then need to design your own even filter from cosine formula. Kadhiem

Reply by ●December 20, 20112011-12-20

Here is example 80 taps root raised cosine. There are several equations that give slight differences. Moreover you may want even taps with two equal centre taps. That needs a different approach(use firls setting Amp as required). B= .15; %rolloff Fs = 1; Rs = Fs/2; Ts = 1/Rs; for i = -39:40 h(i+40) = (sin(pi*i/Ts*(1-B)) + 4*B*i/Ts*cos(pi*i/Ts*(1+B)))/(pi*i/Ts*(1-(4*B*i/Ts)^2)); end h(40) = 1; kadhiem