Analyze Transfer Functions and Step Response

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ก.พ. 2025
  • Demonstration of transfer function analysis with pole (roots of denominator) analysis and a Python step response. See apmonitor.com/p... for example code source.

ความคิดเห็น • 8

  • @mechatronicsninja3806
    @mechatronicsninja3806 5 ปีที่แล้ว +1

    Thank you Sir for this tutorial . is it possible to get a simulation of the function response with a real time changing input. For example I have an input from a potentiomiter connected to arduino , and I want to simulate a second-order open-loop system response to this input.

    • @apm
      @apm  5 ปีที่แล้ว +1

      Sure, that isn't a problem. Here is some source code for 2nd order systems. Take a look at the other labs as well (A-H). apmonitor.com/do/index.php/Main/TCLabD

  • @KidoDepp
    @KidoDepp 5 ปีที่แล้ว +1

    Hey thanks for the video. I was trying to do some transfer function algebra and I couldn't quite make all of it work in my use case(particularly division). I then found Python Control Systems Library (pip install control), and it lets you define base 's' like in Matlab and perform all the algebra, and in general is a bit less messy:
    import numpy as np
    from scipy import signal
    import matplotlib.pyplot as plt
    ## i had to split up the original open loop TF
    A = 200*np.poly1d([1,1])*np.poly1d([1,2])
    B = np.poly1d([1,3])*np.poly1d([1,4])*np.poly1d([1,15,10])
    ApB = A+B
    # the closed loop TF ended up being A/(A+B)
    Gcl = signal.TransferFunction(A, ApB)
    t,y = signal.step(Gcl)
    plt.plot(t,y)
    plt.show()
    ##VS control:
    import control as co
    s = co.tf("s")
    ## this open loop TF was originally given
    Golc = 200*(s+1)*(s+2)
    /( (s+3)*(s+4)*(s**2+15*s+10) ) # so it reads more like the text book
    Gclc = co.feedback(Golc)
    # inbuilt function to calc closed loop TF
    t1,y1 = co.step_response(Gclc)
    plt.plot(t1,y1)
    plt.show()
    Apologies for the code, just wanted to share because I found this video first when looking for python Matlab equivalent and control lib seems to do it :)
    Also control lib has many other matlab-like convenience features like feedback()

    • @apm
      @apm  5 ปีที่แล้ว

      Thanks for sharing that code. There are also some nice features in sympy for Laplace transforms and inverse Laplace transforms.

  • @dominikr.b.5369
    @dominikr.b.5369 6 ปีที่แล้ว

    It's almost a year since the video was posted, but I still want to ask: why can we use convolution OR multiplication to make the transferfunction? the convolution of (s-1) with itself and the multiplication (s-1)^2 should not be the same, I think...But it is, and I dont understand why. Or is it because of how the numpy function works?

    • @apm
      @apm  6 ปีที่แล้ว

      (s-1)^2 = (s^2-2s+1) The key with solving these types of systems is getting it into a form that is found in the Laplace tables. apmonitor.com/pdc/index.php/Main/LaplaceTransforms
      Sometimes you also need to perform partial fraction expansion.

  • @jacobesplin20
    @jacobesplin20 6 ปีที่แล้ว

    How can you add dead time? Like the matlab tf(num,den,'InputDelay',10)? I can not seem to find a solution.

    • @apm
      @apm  6 ปีที่แล้ว

      I don't think that they scipy.signal.TransferFunction supports input delay currently. You may want to see the control package python-control: python-control.readthedocs.io/en/latest/matlab.html#time-delays (see Pade approximation)