Untitled
unknown
plain_text
8 days ago
575 B
2
Indexable
import numpy as np import matplotlib.pyplot as plt # Define the function def f(x): return 2 * np.sin(x + np.pi/2) + 1 # Generate x values x = np.linspace(-2*np.pi, 2*np.pi, 1000) # Generate y values y = f(x) # Plot the graph plt.plot(x, y, label=r'$f(x) = 2 \cdot \sin\left(x + \frac{\pi}{2}\right) + 1$') plt.title("Trigonometric Function Graph") plt.xlabel("x") plt.ylabel("f(x)") plt.grid(True) plt.axhline(0, color='black', linewidth=0.5) plt.axvline(0, color='black', linewidth=0.5) plt.legend() plt.show()
Editor is loading...
Leave a Comment