Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8615565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:24:33+00:00 2026-06-12T05:24:33+00:00

I have obtained some Z coefficients in MatLAB. Now I need to implement the

  • 0

I have obtained some Z coefficients in MatLAB. Now I need to implement the filter in C.
How do I do this?
The coefficients in Z domain:

num = [0.2557 -0.5115 -0.2557 1.0230 -0.2557 -0.5115 0.2557];

den = [1.0000 -4.0196 6.1894 -4.4532 1.4208 -0.1418 0.0044];

Any help is appreciated.

(I tried googling, but didn’t find anything clear and easy to understand.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:24:35+00:00Added an answer on June 12, 2026 at 5:24 am

    I’m guessing that the main issue is translating from Z domain to time.

    Y(z) = H(z)*X(z)

    H(z) = B(z)/A(z) = Y(z)/X(z)

    B(z)*X(z) = A(z)*Y(z)

    Then from the documentation:

    B(z) = b(1)*z^-n + … + b(n+1)
    A(z) = z^-n + … + a(n+1)

    Converting to time domain:

    b(1)*x(t) + b(2)*x(t-1) + … + b(n+1)*x(t-n) = a(1)y(t) + … + a(n+1)*y(t-n)

    Then ‘solving’ for y(t), given that a(1) is 1:

    y(t) = b(1)*x(t) + b(2)*x(t-1) + … + b(n+1)*x(t-n) – a(2)*y(t-1) … – a(n+1)*y(t-n)

    where n = 7. So, say you have to arrays in which you store the last 6 values of the input x and the filter output y:

    /* Warning Warning Warning: 
       This has not been tested,
       for illustration purposes only */
    double filter_data(double x)
    {
      static double x_prev[6] = {0};
      static double y_prev[6] = {0};
      /* x is newest input value */
      double y;  /* output to be calculated */
      int ii;
    
      /* let's just keep it really simple for now, you can get more sophisticated later */
      y = 0.2557*x[0] + -0.5115*x_prev[0] + -0.2557*x_prev[1] + 1.0230*x_prev[2] + 
          -0.2557*x_prev[3] + -0.5115*x_prev[4] + 0.2557*x_prev[5] - -4.0196*y_prev[0] - 
          6.1894*y_prev[1] - -4.4532*y_prev[2] - 1.4208*y_prev[3] - -0.1418*y_prev[4] - 
          0.0044*y_prev[5];
    
      /* really really wasteful, but simple shift of previous values */
      for(ii=5;ii>0;ii--)
      {
        y_prev[ii] = y_prev[ii-1]
        x_prev[ii] = x_prev[ii-1]
      }
      y_prev[0] = y;
      x_prev[0] = x;
      return y;
    }
    

    It’s not great, but I think that ought to get you going. Let me know if something isn’t clear!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I have a PyObject * obtained from PyArg_ParseTuple , do I need to
With the arima function I found some nice results, however now i have trouble
I have inherited some code which involves a scheduled task that writes data (obtained
Let's say I have some kind of collection and I obtained an iterator for
I sometimes have the need to make sure some instances are excluded from a
I have a requirement where some data has to be obtained by connecting to
Variants of this question have been asked several times now here, but my question
I have been reading this similar SO question but some of the approaches suggested
I have this code that takes a file path that is obtained with the
I need to fetch some values obtained from an web URL. The JSON is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.