Created
January 25, 2023 11:17
-
-
Save OmarAlkousa/3f7d8e9784129cc9d9c1211d54a652ab to your computer and use it in GitHub Desktop.
This gist is to represent how to generate a simple sine wave using numpy package and plot the results using matplotlib.
This file contains hidden or 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
# Import the required packages | |
import numpy as np | |
import matplotlib.pyplot as plt | |
plt.style.use('seaborn-poster') | |
%matplotlib inline | |
# Generate a vector with 200 sample from 0 to 20 | |
x = np.linspace(0,20,200) | |
# Generate the sine wave of x variables | |
y = np.sin(x) | |
# Plot the generated singal | |
plt.figure(figsize=(8,8)) | |
plt.plot(x, y, 'b') | |
plt.xlabel('Location (x)') | |
plt.ylabel('Amplitude') | |
plt.title('This is a sine signal') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment