Week 7 - GSoC '21

Week 7 has been quite exciting. I worked mainly on the plotting features in the control module. I implemented all the plots mentioned in my proposal. After properly writing the documentation, the PR will be ready to merge. Here is a glimpse of all the plots:

  1. Pole-Zero Plot

     from sympy.abc import s
     from sympy.physics.control.lti import TransferFunction
     from sympy.physics.control.plots import pole_zero
     H_1 = TransferFunction(2*s**2 + 5*s + 1, s**2 + 3*s + 5, s)
     pole_zero(H_1)
    

    image

  2. Root-Locus Plot

     from sympy.abc import s
     from sympy import I
     from sympy.physics.control.lti import TransferFunction
     from sympy.physics.control.plots import root_locus
     H_1 = TransferFunction((s + 0.2)*(s + 2.5), (s + 1 + 1.4*I)*(s + 1 - 1.4*I), s)
     root_locus(H_1)
    

    tf

     H_2 = TransferFunction(s + 7, s*(s + 5)*(s + 15)*(s + 20), s)
     root_locus(H_2)
    

    rootloci_2

  3. Bode Plot

     from sympy.abc import s
     from sympy.physics.control.lti import TransferFunction
     from sympy.physics.control.plots import bode_plot
     H_1 = TransferFunction(1*s**2 + 0.1*s + 7.5, 1*s**4 + 0.12*s**3 + 9*s**2, s)
     bode_plot(H_1)
    

    ima

  4. Step-Response

     from sympy.abc import s
     from sympy.physics.control.lti import TransferFunction
     from sympy.physics.control.plots import step_response
     H_1 = TransferFunction(8*s**2 + 18*s + 32, 1*s**3 + 6*s**2 + 14*s + 24, s)
     step_response(H_1)
    

    output2

  5. Impulse-Response

     from sympy.abc import s
     from sympy.physics.control.lti import TransferFunction
     from sympy.physics.control.plots import impulse_response
     H_1 = TransferFunction(8*s**2 + 18*s + 32, 1*s**3 + 6*s**2 + 14*s + 24, s)
     impulse_response(H_1)
    

    impul

  6. Ramp-Response

     from sympy.abc import s
     from sympy.physics.control.lti import TransferFunction
     from sympy.physics.control.control_plots import ramp_response
     H_1 = TransferFunction(s, (s+4)*(s+8), s)
     ramp_response(H_1, upper_limit=2)
    

    ramp

The API is not final, and there will definitely be more changes as the review process goes on. I am delighted that the efforts that I put into these graphs paid off well. After the PR is merged (Hopefully in a couple of days or a little bit more :smile:), you can just copy and paste these code snippets to reproduce the plots.

Apart from these plots, I have been working on the Feedback class. Adding the support for MIMO systems and tidying the documentation are some of the main things to be done in the class.