GithubHelp home page GithubHelp logo

Comments (11)

ar1st0crat avatar ar1st0crat commented on July 18, 2024

TF numerator is simply the impulse response (for FIR filters):

double[] impulseResponse;
//...

// IR -> TF
var tf = new TransferFunction(impulseResponse);

// TF -> IR
var kernel = tf.Numerator;  // filter 'kernel' is a synonym for IR

The impulse response of IIR filters is infinite (hence, the name).

If you are asking about the Partial Fraction Expansion method (used for doing the inverse Z-transform and finding analytic representation of impulse response), it's not implemented. Although there's a method DesignFilter.TfToSos decomposing TF into a collection of second-order sections TFs.

from nwaves.

ToGoOrNotToGo avatar ToGoOrNotToGo commented on July 18, 2024

Yes I am looking for TF estimation of a given impulse response from an IIR filter by using Z-tranform.
(and I start learning Z-Transform... oh and have to learn SOS... holy cow... ;-) )

from nwaves.

ToGoOrNotToGo avatar ToGoOrNotToGo commented on July 18, 2024

Maybe a method like this is interesting for the TransferFunction class: https://www.mathworks.com/help/ident/ref/tfest.html

from nwaves.

ar1st0crat avatar ar1st0crat commented on July 18, 2024

Impulse response of an IIR filter is infinite, so it can't be given in a finite array. Infinite impulse response can be derived only analytically from the TF / difference equations (so it's an inverse task).

For example, if we have TF 1 / (1-2z^-1) then the impulse response for all |z| > 2 is: 2^n u[n], n = -∞, ..., -2, -1, 0, 1, 2, ... ∞ where u[n] is the unit step function (i.e. infinite signal). DSP textbooks explain the math behind this.

Thus, you can have infinite impulse response only in analytic form like above and take Z-transform from it. I'm quite sure this is not what you need (most likely, you'll have just filter coefficients: non-recursive part of the difference equation is TF.Numerator and recursive part is TF.Denominator). But if I'm wrong then the symbolic math libraries can be used for analytical computations (like in this case - Z-transform series). This lib is not designed for these tasks.

from nwaves.

ar1st0crat avatar ar1st0crat commented on July 18, 2024

Regarding tfest - maybe it'll be added to NWaves someday )). However, it solves another task: it finds the best estimate of the TF based on input/output in time domain or system behaviour in frequency domain.

from nwaves.

ToGoOrNotToGo avatar ToGoOrNotToGo commented on July 18, 2024

There are more techniques calculation TF: "Impulse invariance" and "TF from bode plot"...
But Z-transform seems to be the most interesting topic...

from nwaves.

ar1st0crat avatar ar1st0crat commented on July 18, 2024

OK, this issue starts becoming like 'contemplations about everything' )). I gave the answer regarding the topic of the issue in my first answer. All in all, you raised three completely different tasks:

  • compute TF from IR (analytically in case of infinite IR)
  • estimate TF from time-domain behaviour or from freq response (tfest)
  • and now you've switched to s-plane -> z-plane conversion

The first task is for symbolic math libraries like symPy. This lib is more practically oriented.

The second task is OK, although it's not related to the topic of the issue. I marked it as an 'enhancement'.

Regarding the third task, in this lib the so called BilinearTransform is implemented - it does the same thing and it's used in IIR filter design. I was also going to add MatchedTransform; it's similar.

There are more techniques calculation TF: "Impulse invariance" and "TF from bode plot"...
But Z-transform seems to be the most interesting topic...

Actually, the entire TransferFunction class is about Z-transform. Z-transform is the mechanism for switching between time-domain difference equations (LTI filter coefficients) and Z-domain (in particular, frequency domain). Some of the tasks are practical and they can be done with NWaves (e.g., TF combinations, zeros\poles analysis, decomposing systems to SOS). However, this lib is not intended for calculus in general.

from nwaves.

ToGoOrNotToGo avatar ToGoOrNotToGo commented on July 18, 2024

OK got it. Thank you very much! You are excellent!
I will now learn "Transfer Function Analysis" first ...

from nwaves.

ar1st0crat avatar ar1st0crat commented on July 18, 2024

No problem, you're welcome )
Also, maybe this repo https://github.com/ar1st0crat/DigitalSignalProcessing will be helpful. (There's a couple of old errors there, though. But I tried to make it quite simple and readable)

from nwaves.

ToGoOrNotToGo avatar ToGoOrNotToGo commented on July 18, 2024

Can TransferFunction.StateSpace and TransferFunction.Zi be used for methods like Scilab's imrep2ss and frep2tf?

from nwaves.

ar1st0crat avatar ar1st0crat commented on July 18, 2024

Currently, no. It's again related to MATLAB tfest function for TF estimation from frequency/impulse response, involving some optimization algorithm. It's not implemented yet...

from nwaves.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.