How do I know how the output of FIR filter were calculated (e.g., each of summands of the FIR)?

For a given set of FIR coefficient b and input data input, I generate FIR output using filter function (e.g., output = filter(b, 1, input)).
Based on the help explaination, the filter is a "Direct Form II Transposed" implementation of the standard difference equation:
a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)
- a(2)*y(n-1) - ... - a(na+1)*y(n-na)
Is there a way to know each of summands before the summations, i.e., b(1)*x(n), b(2)*x(n-1), ..., for each of input or time instance?

4 Comments

Hi Jay,
Based on filter, the terms b(2)*x(n-1), ... don't appear in its implementation. Is the goal to compute intermediate terms in the filter() implementation?
Hi Paul,
Thanks for the comment. I want to know the intermediate terms for verifying hardware implementation. Is there any way or fuction to provide the intermediate terms? Otherwise, it seems that I need to model it.
AFAIK, there is no function that provides the intermediate terms from filter. The actual implementation of the filter is shown in the More About section of the doc page from which one could, in principal, compute the intermediate terms, by which I mean the w_i.
Maybe there is an alternative function to filter() that will do the filtering and provide additional outputs of intermediate quantities.
Thanks Paul. Perhaps I need to model and implement a FIR to populate the intermediate terms. Thanks!

Sign in to comment.

Answers (1)

Hi Jay,
I understand you want to access or compute each term in the standard difference equation of an FIR filter for every input or time instance, rather than just the overall output. One way this can be achieved is by using the Filter Designer app and Simulink. Here is a step-by-step guide:
  1. Design the filter using the Filter Designer app.
  2. From the left pane, select 'Realize Model', enable the option to build the model using basic elements, and click 'Realize Model'.
  3. This action opens a Simulink model with the ‘filter’ block. Select all the signals inside the filter block and enable signal logging from the ‘Simulation’ tab.
  4. Add a ‘constant’ block with the desired input to the filter and run the simulation.
  5. An object named ‘out’ will appear in the MATLAB workspace after the simulation is complete. Inside the ‘out’ object, the ‘logsout’ object contains all logged signals. The values of all the logged signals for each of the input value or time instance can be accessed from the ‘Values’ timeseries object.
To know more about Filter Designer app and signal logging, please refer to the below MATLAB documentations:

1 Comment

Thanks Abhishek for sharing this. Unfortunately, I don't have Simulink in my environment. I implemented a "Direct Form II Transposed" FIR implementation myself to see the each summand instead of using the native filter function. Thanks.

Sign in to comment.

Tags

Asked:

Jay
on 15 Mar 2024

Commented:

Jay
on 6 May 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!