+ Post New Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 21
  1. #1
    Newbie level 6
    Points: 127, Level: 1

    Join Date
    Dec 2016
    Posts
    13
    Helped
    0 / 0
    Points
    127
    Level
    1

    Inverse Transfer Function in s-Domain

    Hello,
    I have the transfer function of a system in the s-domain. For a given output I want to obtain the input. The most natural way to me seems to multiply the output with the inverse of the
    transfer function. The problem in implementing this e.g. in Matlab is, that the inverse transfer function would have more zeros than poles which leads to an error.
    Another idea is for example to implement a block diagram in simulink. The input is my output signal and in the negative feedback I put the original transfer function. This approach, however does not lead to the desired results.
    I'm glad for any hints!

  2. #2
    Advanced Member level 3
    Points: 4,035, Level: 14

    Join Date
    Dec 2015
    Location
    Madrid, Spain
    Posts
    723
    Helped
    179 / 179
    Points
    4,035
    Level
    14

    Re: Inverse Transfer Function in s-Domain

    Do you have analytical form of the output , or just an array of values ?



  3. #3
    Advanced Member level 4
    Points: 10,420, Level: 24
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    1,456
    Helped
    401 / 401
    Points
    10,420
    Level
    24

    Re: Inverse Transfer Function in s-Domain

    Quote Originally Posted by twig27 View Post
    The problem in implementing this e.g. in Matlab is, that the inverse transfer function would have more zeros than poles which leads to an error.
    Simply decompose to N(s)/D(s) + A(s), where order of N(s) <= order of D(s).



    •   Alt9th December 2016, 17:32

      advertising

        
       

  4. #4
    Newbie level 6
    Points: 127, Level: 1

    Join Date
    Dec 2016
    Posts
    13
    Helped
    0 / 0
    Points
    127
    Level
    1

    Re: Inverse Transfer Function in s-Domain

    The output is just an array of values



  5. #5
    Advanced Member level 4
    Points: 10,420, Level: 24
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    1,456
    Helped
    401 / 401
    Points
    10,420
    Level
    24

    Re: Inverse Transfer Function in s-Domain

    Quote Originally Posted by twig27 View Post
    The output is just an array of values
    What do you want to mean ?



  6. #6
    Super Moderator
    Points: 231,316, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    39,929
    Helped
    12199 / 12199
    Points
    231,316
    Level
    100

    Re: Inverse Transfer Function in s-Domain

    Answering post #2, I suppose.



    •   Alt12th December 2016, 11:13

      advertising

        
       

  7. #7
    Advanced Member level 4
    Points: 10,420, Level: 24
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    1,456
    Helped
    401 / 401
    Points
    10,420
    Level
    24

    Re: Inverse Transfer Function in s-Domain

    Quote Originally Posted by twig27 View Post
    The output is just an array of values
    Even if output is just an array of values, there is no problem.

    You can use combination of lsim() and diff() in MATLAB.

    H(s)=N(s)/D(s) + A(s)

    lsim() for N(s)/D(s)
    diff() for A(s)



    •   Alt12th December 2016, 14:28

      advertising

        
       

  8. #8
    Newbie level 6
    Points: 127, Level: 1

    Join Date
    Dec 2016
    Posts
    13
    Helped
    0 / 0
    Points
    127
    Level
    1

    Re: Inverse Transfer Function in s-Domain

    What do you mean with the diff-Operator in this case?
    If I decompose A(s) still has more zeros than poles.



  9. #9
    Advanced Member level 4
    Points: 10,420, Level: 24
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    1,456
    Helped
    401 / 401
    Points
    10,420
    Level
    24

    Re: Inverse Transfer Function in s-Domain

    Last edited by pancho_hideboo; 13th December 2016 at 13:25.



  10. #10
    Advanced Member level 3
    Points: 4,035, Level: 14

    Join Date
    Dec 2015
    Location
    Madrid, Spain
    Posts
    723
    Helped
    179 / 179
    Points
    4,035
    Level
    14

    Re: Inverse Transfer Function in s-Domain

    Plot the output and show it here. Show transfer function of your model also.



  11. #11
    Advanced Member level 2
    Points: 4,182, Level: 15

    Join Date
    Feb 2015
    Posts
    689
    Helped
    208 / 208
    Points
    4,182
    Level
    15

    Re: Inverse Transfer Function in s-Domain

    This is the problem of deconvolution. https://en.wikipedia.org/wiki/Deconvolution

    In general, you will have an approximation of the inverse. It is sometimes impossible to get an exact inverse. For example, a highpass filter with 0 gain at 0Hz will result in an inverse filter with infinite gain at 0Hz.

    Likewise, for a causal filter the inverse will be non-causal.



  12. #12
    Newbie level 6
    Points: 127, Level: 1

    Join Date
    Dec 2016
    Posts
    13
    Helped
    0 / 0
    Points
    127
    Level
    1

    Re: Inverse Transfer Function in s-Domain

    Ok so below I attached the circuit model. This model is a rough estimate of what the system really looks like. In order to re-obtain the input signal (which is the current at the amp-meter, a mono-exponential decay) I first want to find a solid method for this model before I apply it to the actual system. Of course I could derive the exact transfer function for the simulation, but since it won't be possible for the real circuit I suppose to only know the output voltage and the input current.
    Click image for larger version. 

Name:	Capture_Circuit.PNG 
Views:	4 
Size:	17.1 KB 
ID:	134556
    Then I used the system identification toolbox in order to estimate the system's transfer function. I did so for different numbers of poles/zeros. (Estimation was >99%).
    I fed that to the Simulink model below. Here I first apply the transfer function to the current input and then do the inverse by putting the transfer function into the negative feedback.
    Click image for larger version. 

Name:	Capture_Simulink.PNG 
Views:	5 
Size:	24.0 KB 
ID:	134553
    If I do so for a transfer function with 2 poles and 2 zeros I approximate the input better for higher gain. However the signal starts to oscillate unboundedly towards the end ( Can be avoided for gain -> inf).
    The important part of the signal (which is the mono-exponential decay at the beginning) can however be reconstructed very well. (Yellow curve is input, red curve after transfer function, blue curve after inverse transfer function).
    Click image for larger version. 

Name:	tf1.jpg 
Views:	5 
Size:	35.5 KB 
ID:	134554
    If I then choose a transfer function with 3 poles and 2 zeros the input signal cannot be approximated anymore by applying the inverse transfer function. If the gain is choose to high an error occurs and the simulation terminates.
    Click image for larger version. 

Name:	tf2.jpg 
Views:	3 
Size:	20.0 KB 
ID:	134555


    From the simulation model I should expect 0 zeros (op amp circuit at output is 2nd order low pass bessel filter) and 3 poles. Results with that combination are however similar to the ones with 3 poles and 2 zeros.
    Thanks for your advice!
    Last edited by twig27; 15th December 2016 at 10:48.



  13. #13
    Newbie level 6
    Points: 127, Level: 1

    Join Date
    Dec 2016
    Posts
    13
    Helped
    0 / 0
    Points
    127
    Level
    1

    Re: Inverse Transfer Function in s-Domain

    Since any of the transfer functions I estimated has zeros in the right half plane, I guess the approach with the transfer function in the negative feedback is not going to work, because the will turn into poles and cause unbounded oscillations. Correct?
    I did also try a Simulink model with input->transfer function->inverse transfer function-> recover input signal. If I however plug in any other signal into the inverse transfer function the ouput will oscillate again.
    Does this mean that for my circuit it is impossible to apply the inverse transfer function to the output in order to recover the input signal?



  14. #14
    Advanced Member level 3
    Points: 4,035, Level: 14

    Join Date
    Dec 2015
    Location
    Madrid, Spain
    Posts
    723
    Helped
    179 / 179
    Points
    4,035
    Level
    14

    Re: Inverse Transfer Function in s-Domain

    First of all, before jumping into the "find the input necessary that gives a desired output" problem, you have to check the output of your model. Seems like the output is unstable for your input. In such case, you have to stabilize it. (I do not see how that is possible since System Identification Toolbox gave you that).
    Since any of the transfer functions I estimated has zeros in the right half plane, I guess the approach with the transfer function in the negative feedback is not going to work, because the will turn into poles and cause unbounded oscillations. Correct?
    Yes.

    If Identification tool from MATLAB gives you several matches, obviously you have to choose the easiest one.

    I did also try a Simulink model with input->transfer function->inverse transfer function-> recover input signal. If I however plug in any other signal into the inverse transfer function the ouput will oscillate again.
    Does this mean that for my circuit it is impossible to apply the inverse transfer function to the output in order to recover the input signal?
    If one of them is unstable, the whole will be unstable.


    1 members found this post helpful.

  15. #15
    Newbie level 6
    Points: 127, Level: 1

    Join Date
    Dec 2016
    Posts
    13
    Helped
    0 / 0
    Points
    127
    Level
    1

    Re: Inverse Transfer Function in s-Domain

    I've been trying to make the inverse transfer function proper by adding negative poles far away from the imaginary axis, i.e. multiplying by (s+1E6)^2.
    This worked well for the simulation containing only the bessel filter which has 2 poles. I am able to get a pretty good reconstruction of my original signal. (The actual poles are around 2E4).
    If I add another RC Lowpass which introduces another pole the same method stops working. In this case I multiply by (s+1E6)^3 before inversion. The transfer function then becomes proper.
    If I choose the artificial poles way to far from the imaginary axis, the reconstruction will also fail.

    Is there a method to find the optimal location of artificial poles, so they only have a negligible impact on the transfer function characteristics?



  16. #16
    Advanced Member level 3
    Points: 4,035, Level: 14

    Join Date
    Dec 2015
    Location
    Madrid, Spain
    Posts
    723
    Helped
    179 / 179
    Points
    4,035
    Level
    14

    Re: Inverse Transfer Function in s-Domain

    10 times farther than the dominant poles should be O.K.


    1 members found this post helpful.

  17. #17
    Advanced Member level 4
    Points: 10,420, Level: 24
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    1,456
    Helped
    401 / 401
    Points
    10,420
    Level
    24

    Re: Inverse Transfer Function in s-Domain

    Quote Originally Posted by twig27
    In my case
    I have a transfer function of the form H(s) = 1/(s^3+a*s^2+b*s+c).
    The inverse would just be the polynomial.
    How can I simulate that in Matlab?
    x1 = diff(x)/dt
    x2 = diff(x1)/dt
    x3 = diff(x2)/dt

    y = x3 + a*x2 + b*x1 + c*x

    If you don't have much data points for input x, you have to increase them by invoking interp1().
    And I recommend independent variable, t is equi-spaced, dt.

    Code:
    dt=2*pi/1000;
    t=[0:dt:2*pi];
    x=sin(t);
    size(x) ->> 1, 1001
    
    x1=diff(x)/dt
    x2=diff(x1)/dt
    x3=diff(x2)/dt
    
    size(x1) ->> 1, 1000
    size(x2) ->> 1, 999
    size(x3) ->> 1, 998
    
    y = x3(1:end) + x2(2:end) + x1(3:end) + x(4:end)
    [Note] : Data of MATLAB is a just array, so there is no independet variable information.

    Code:
    >> plot(x, 'r')
    >> hold on, grid on
    >> plot(x1, 'c')
    >> plot(x2, 'g')
    >> plot(x3, 'y')
    Last edited by pancho_hideboo; 8th February 2017 at 11:59.



  18. #18
    Newbie level 6
    Points: 127, Level: 1

    Join Date
    Dec 2016
    Posts
    13
    Helped
    0 / 0
    Points
    127
    Level
    1

    Re: Inverse Transfer Function in s-Domain

    Thanks for explaining the technique! It works quite well, however there are problems when I try reconstruct a signal containing high freuquencies. The reconstructed signal exhibits strong oscillations. Are there certain constraints with regard to time resolution?

    Could you recommend any literature on this?
    Thanks!



  19. #19
    Advanced Member level 4
    Points: 10,420, Level: 24
    pancho_hideboo's Avatar
    Join Date
    Oct 2006
    Location
    Real Homeless
    Posts
    1,456
    Helped
    401 / 401
    Points
    10,420
    Level
    24

    Re: Inverse Transfer Function in s-Domain

    Quote Originally Posted by twig27 View Post
    however there are problems when I try reconstruct a signal containing high freuquencies.
    The reconstructed signal exhibits strong oscillations.
    Are there certain constraints with regard to time resolution?
    Show me input signal and reconstructed output signal.

    Quote Originally Posted by twig27 View Post
    Could you recommend any literature on this?
    It is no more than linear differential and integral equation problem.
    So any elementary mathematics text book will be enough helpful for you.

    Consider a decomposition of an input signal to low frequency and high frequency components.
    Last edited by pancho_hideboo; 15th February 2017 at 16:33.



  20. #20
    Advanced Member level 3
    Points: 4,035, Level: 14

    Join Date
    Dec 2015
    Location
    Madrid, Spain
    Posts
    723
    Helped
    179 / 179
    Points
    4,035
    Level
    14

    Re: Inverse Transfer Function in s-Domain

    Quote Originally Posted by pancho_hideboo View Post
    Consider a decomposition of an input signal to low frequency and high frequency components.
    Periodic signal or whatever signal?



    •   Alt15th February 2017, 17:39

      advertising

        
       

--[[ ]]--