![]() |
Multiple Plots in Spyder - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Multiple Plots in Spyder (/thread-39350.html) |
Multiple Plots in Spyder - PythonAndMe2023 - Feb-03-2023 Hello I'm relatively new to Python and am not sure how to best display multiple plots in Spyder. The code below always displays the last plot (each single one works - tested by putting the last one(s) in '''...'''). Can somebody please help me with this? My Code: # pip install control import numpy as np import control import matplotlib.pyplot as plt from control.matlab import * # 4s+1 # --------- # 2s^2+5s-2 num = np.array([4, 1]) den = np.array([2, 5, -2]) # Transfer Function H = control.tf(num, den) print('H(s) =', H) # Zeros z = control.zero(H) print('z =', z) # Poles p = control.pole(H) print('p =', p) # P-Z Map-------------------------------------- 1st plot control.pzmap(H) # Bode Plot------------------------------------ 2nd plot mag, phase, omega = control.bode(H) # Step Response-------------------------------- 3rd plot t, y = control.step_response(H) plt.plot(t, y) plt.title("Step Response") plt.grid() # lsim------------------------------------------ 4th plot t = np.arange(0, 20, 0.01) w0 = 3 u = np.cos(w0*t) yout, T, xout = lsim(H, u, t, X0=0.0) plt.plot(t, yout) plt.grid() plt.show() |