herrDeng網內搜尋

自訂搜尋

Ads

2021年5月6日 星期四

優化Robomaster循跡小車調PID使用cos餘弦函數

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3.  
  4. x = np.linspace(-np.pi,np.pi,1000)
  5. y = np.cos(x)
  6. yy=1+y/2
  7.  
  8. plt.plot(x,y, 'b', label='y=cos(x)')
  9. plt.plot(x,yy, 'r', label='y=1+0.5*cos(x)')
  10. plt.legend(loc='lower center')
  11.  
  12. plt.savefig('cos_fig.png')
  13. plt.show()

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章