Added piecewise snippet
This commit is contained in:
parent
8ebc6a36bc
commit
1a48e961bb
18
piecewise/piecewise
Normal file
18
piecewise/piecewise
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user