import numpy as npimport matplotlib.pyplot as plt
x = np.linspace(-2np.pi, 2np.pi, 1000)y1 = np.cos(x + np.pi/2) + 1y2 = np.cos(x - np.pi/3) + 2y3 = np.cos(x - np.pi/2) - 0.5y4 = np.cos(x + np.pi/6) - 3
plt.figure(figsize=(12, 8))plt.subplot(221)plt.plot(x, y1, label='y = cos(x + π/2) + 1')plt.legend()plt.grid()
plt.subplot(222)plt.plot(x, y2, label='y = cos(x - π/3) + 2')plt.legend()plt.grid()
plt.subplot(223)plt.plot(x, y3, label='y = cos(x - π/2) - 1/2')plt.legend()plt.grid()
plt.subplot(224)plt.plot(x, y4, label='y = cos(x + π/6) - 3')plt.legend()plt.grid()
plt.show()
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-2np.pi, 2np.pi, 1000)
y1 = np.cos(x + np.pi/2) + 1
y2 = np.cos(x - np.pi/3) + 2
y3 = np.cos(x - np.pi/2) - 0.5
y4 = np.cos(x + np.pi/6) - 3
plt.figure(figsize=(12, 8))
plt.subplot(221)
plt.plot(x, y1, label='y = cos(x + π/2) + 1')
plt.legend()
plt.grid()
plt.subplot(222)
plt.plot(x, y2, label='y = cos(x - π/3) + 2')
plt.legend()
plt.grid()
plt.subplot(223)
plt.plot(x, y3, label='y = cos(x - π/2) - 1/2')
plt.legend()
plt.grid()
plt.subplot(224)
plt.plot(x, y4, label='y = cos(x + π/6) - 3')
plt.legend()
plt.grid()
plt.show()