lundi 29 juin 2015

How do I make a sine graph in Python that has adjustable values for A B C and D in the equation y=Asin(B*(X-C)+D? Beginner programmer :v


import matplotlib.pyplot as plt
import numpy as np


A = 2 
B = 2 
C = 3
D = 4
sample = 16
x = np.arange(sample)
y = (A*np.sin(B*(x-C))+D) 
plt.plot(x, y)
plt.xlabel('voltage(V)')
plt.ylabel('sample(n)')
plt.show()

the y= part is the equation the A B C D values are on top. whenever I try to graph this it comes out wrong


Aucun commentaire:

Enregistrer un commentaire