Last active
May 25, 2024 20:00
-
-
Save uwezi/0cf70c8dae11a796d56452a7e012d7bd to your computer and use it in GitHub Desktop.
[system response] Plotting system response function in Manim. #manim #scipy #systemresponse #plot #linegraph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy import signal | |
class stepResponse(Scene): | |
def construct(self): | |
T = np.linspace(0,10,1000) | |
sys = signal.TransferFunction([1,3,3], [1,2,1]) | |
t, y1 = sys.impulse(T=T) | |
t, y2 = sys.step(T=T) | |
ax = Axes( | |
x_range=[-1,12,1], | |
x_length=[13], | |
y_range=[-3,3,.5], | |
y_length=7, | |
tips=False, | |
).add_coordinates() | |
self.add(ax) | |
iresp = ax.plot_line_graph( | |
t, y1, | |
add_vertex_dots=False, | |
line_color=YELLOW, | |
) | |
sresp = ax.plot_line_graph( | |
t, y2, | |
add_vertex_dots=False, | |
line_color=RED, | |
) | |
self.add(iresp,sresp) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment