28 lines
516 B
Python
28 lines
516 B
Python
|
# encoding utf8
|
||
|
|
||
|
"""
|
||
|
计算步进电机S型加减速算法所需的S型曲线表
|
||
|
"""
|
||
|
|
||
|
import numpy as np
|
||
|
import matplotlib.pyplot as plt
|
||
|
import math
|
||
|
|
||
|
np.set_printoptions(suppress=True)
|
||
|
# 电机运行最低频率
|
||
|
step_min_freq = 200
|
||
|
# 电机运行最高频率
|
||
|
step_max_freq = 6000
|
||
|
|
||
|
x = np.arange(-5, 5, 0.1)
|
||
|
y = 1/(1+np.exp(-x))
|
||
|
|
||
|
time_table = (1000000/(step_min_freq+(step_max_freq-step_min_freq)*y))
|
||
|
# plt.plot(x,y)
|
||
|
# plt.show()
|
||
|
|
||
|
for data in time_table.tolist():
|
||
|
print(int(data), end=',')
|
||
|
# print(data)
|
||
|
|