0
$\begingroup$

In MATLAB, latency at the start of the output of a filter can be handled by discarding those bits and starting the signal where the latency ends. but how can the garbage value at the end be handled?

$\endgroup$

1 Answer 1

3
$\begingroup$

You may use the internal state variable zf that is available as an output from the filter function

[y,zf]=filter([ 1 2 3],1,[1 0 0 0 1 ])

it contains the final condition of the filter, in the example above (with b=[1 2 3] and a=1) you will get

y =

     1     2     3     0     1

zf =

     2
     3

Concatenating zf to the end of y will give you the complete output signal, it is the same as adding zeros to the input signal at the end.

 y=filter([ 1 2 3],1,[1 0 0 0 1 0 0])

 y =
     1     2     3     0     1     2     3 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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