Created
June 25, 2016 16:06
-
-
Save ataias/46d758937c18c9f024a07a21b9503b0e to your computer and use it in GitHub Desktop.
Create ramp input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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