diff --git a/piecewise/piecewise b/piecewise/piecewise new file mode 100644 index 0000000..b0480fb --- /dev/null +++ b/piecewise/piecewise @@ -0,0 +1,18 @@ +import numpy as np +import matplotlib.pyplot as plt + +tot_time = 200 + +time1 = 30 +time2 = 90 +time3 = 150 + +depth0 = 0 +depth1 = 3 +depth2 = 5 + +depth_des = np.arange(tot_time) + +depth_des = np.piecewise(depth_des, [depth_des < time1, (depth_des >= time1) & (depth_des < time2), (depth_des >= time2) & (depth_des < time3), depth_des >= time3], [depth0, depth1, depth2, depth0]) + +plt.plot(depth_des)