First of all I'm new to DSP so excuse my simplified words & I'm sorry if it's a duplicated question.

Now, I'm trying to filter a signal but as you all know, the filter step response overshoot the filtered signal at the beginning.

Here it's the signal. It begins with zeros then the signal comes up the signal

Is there any accurate solution to remove this overshoot completely? the question

** And if there is references or any direct command in Matlab, I would be grateful to know it.**

Thanks in advance..

  • 1
    $\begingroup$ Why do you call it overshoot? It seems to reflect the character of the original signal well? To me, it sounds like you want to remove the variation in the signal after the step... and that variation is in the original signal. $\endgroup$ – Peter K. Aug 29 '13 at 0:41
  • 1
    $\begingroup$ If you used a "brick wall" filter, don't. The ringing is one reason why not to. $\endgroup$ – hotpaw2 Aug 29 '13 at 3:52

You said you were new to DSP, but in reality, anyone new to filtering (analog or digital) has the same problem. In other words, we all learn about filtering in the frequency domain but pay little attention to what is taught about the effects of filtering in the time domain.

The problem you are showing, excessive overshoot and ringing, is most easily solved by choosing a diffrent type of filter. You don't say say what type of filter you are using, but it most certainly has a very sharp transition band, and a flat pass band, or a ripple in the pass band, which allows for a sharper transition band.

An extreme example of just the oppisite of your filter is the Gaussian response, which has roll off in the pass band and a wide transition band. Its time domain response will have no overshoot or ringing, but also has "poor" attenuation characteristics.

The solution then, is to design a filter that gives as much filtering as needed, but doesn't cause any more overshoot and ringing than your application can tolerate. You need to learn that with filters, you can have sharp filters, or you can have minimal distortion (overshoot and ringing), but not both.

I am not a MatLab user, so I can't suggest a specific MatLab function to use. Might I suggest some free FIR and IIR software that will clearly and easily demonstrate what I have said here. Both the FIR and IIR programs allow you to adjust the filter's response in the freqency domain, and quickly see the effects in the time domain. In the IIR program, experiment with the Gauss and Elliptic responses as extreme oppisites of one another. The programs are available at http://www.iowahills.com/

Also, you need to pay attention to the filter's group delay. For 2 filters with essentially the same magnitude response, the filter with the more linear phase (flatter group delay) will cause less distortion.

  • $\begingroup$ "you can have sharp filters, or you can have minimal distortion (overshoot and ringing), but not both." It's possible to make filters with "reversals" but no overshoot. See Figure 6 in smp.uq.edu.au/people/YoniNazarathy/Control4406/resources/… Can these be made to have arbitrarily sharp frequency cutoff? $\endgroup$ – endolith May 20 '14 at 18:41

There are a couple of subtle issues here.

The first one is: what are you trying to achieve? The first image above (unfiltered signal) already has "overshoot". Are you trying to remove the oscillations about $1$ after about $t=0.13$ ??

The second one is: the filter you appear to have used has a very large delay, which means the rise in value has moved from $t=0.13$ to $t=0.37$ or so. That suggests that you've used a very long filter (for the size of data).

I'd suggest using a shorter (lower order) filter.

Here is some scilab code that tries two approaches:

x = [zeros(130,1);
  1.2*ones(370,1) + 0.2*cos(2*%pi*[0:369]'/90)];

y = x + 0.1*rand(500,1,'normal');

[h,hm,fr]=wfir("lp",33,[.05 0],"hm",[0 0])

z = filter(h,1,y);

alpha = 0.98;
zz = filter(1-alpha, [1 -alpha], y);


The first, z, uses a relatively short FIR filter. This does not resolve issue #1 (removing the oscillation).

The second, zz, uses a first order IIR filter (exponential forgetter). This has the advantages of simplicity and reducing the amount of oscillation. The disadvantage is that it takes a while for the filtered value to reach $1$.

enter image description here

The noiseless signal is blue, the noisy signal is plotted as red dots, the FIR filtered noisy signal is in green and the first-order filtered noisy signal is in magenta.

  • $\begingroup$ Dumb question, isn't the average (green FIR + magenta IIR) / 2 nearer to what the OP wants ? Or .4 FIR + .6 IIR, or ... (How does one go about designing a sum, FIR + IIR ?) $\endgroup$ – denis Nov 30 '14 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.