参考自stackoverflow上的答案

1 import numpy as np
2 import matplotlib.pyplot as plt
3 
4 def f(x):
5     return np.int(x)
6 f2 = np.vectorize(f)#让函数矩阵化,解决只能一对一强制性变换这一要求
7 x = np.arange(1, 15.1, 0.1)
8 plt.plot(x, f2(x))
9 plt.show()

 

相关文章:

  • 2021-12-13
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-08
  • 2021-12-27
  • 2021-06-30
  • 2021-06-01
  • 2021-12-03
相关资源
相似解决方案