Home > Mobile >  How to Fix the Wavelength of a Sine Wave With Matplotlib and Numpy
How to Fix the Wavelength of a Sine Wave With Matplotlib and Numpy

Time:12-15

I am trying to graph a sine wave using numpy and matplotlib. Although the amplitude of the wave (1 by default) is correct, the wave's wavelength should measure at a length of $2 \pi$. As can be seen in the image below, the sine wave's wavelength is around 60.

result

CodePudding user response:

np.sin(x) documentary here.

expects x to be array_like and an Angle, in radians ( rad equals 360 degrees).

try handing over

x = np.linspace(-np.pi, np.pi, 180)

documentary for linspace here.

  • Related