Skip to content

Instantly share code, notes, and snippets.

@ataias
Created June 25, 2016 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ataias/46d758937c18c9f024a07a21b9503b0e to your computer and use it in GitHub Desktop.
Save ataias/46d758937c18c9f024a07a21b9503b0e to your computer and use it in GitHub Desktop.
Create ramp input
import numpy
import matplotlib.pyplot as plt
n = 400
Ts = 0.1
t = numpy.linspace(0,n,n+1)*Ts
out_max = 0.3
y_ref = numpy.ones(n+1)*out_max
zero_time = 2.0
start = int(zero_time/Ts)
y_ref[0:start] = 0.0 #first 2 seconds equal to zero
movement_period = 4
total_movement_time = int(movement_period/Ts)
for i in range(0,total_movement_time):
y_ref[i+start] = i*out_max/total_movement_time
plt.plot(t, y_ref)
plt.grid()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment