LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 5 years have passed since last update.

Matplotlib 演習問題回答

Last updated at Posted at 2018-03-07

1 .mathモジュールのsin()やcos()関数を使い、
Sin波のグラフとCos波のグラフを描画してみてください。
numpyなどのモジュールを使ってデータを作っていただいても他の方法でも構いません。

sample.py
import matplotlib.pyplot as plt
import numpy as np

x = np.arange(-5, 5, 0.1)
y1 = np.cos(x)
y2 = np.sin(x)
y3 = np.sin(-1 * x)
plt.plot(x, y1)
plt.plot(x, y2)
plt.plot(x, y3)
plt.show()

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up