Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def symulacja_histereza(a, uzad, y0, yzad, T, h, hist):
- t = np.arange(0, T, h)
- y = np.zeros(t.shape[0])
- e = np.zeros(t.shape[0])
- u = np.zeros(t.shape[0])
- y[0] = y0
- e[0] = yzad - y0
- if(e[0]>0): u[0]=uzad
- else: u[0]=0
- for i in range(t.shape[0]-1):
- y[i+1] = y[i] + h*(a*y[i]+u[i])
- e[i+1] = yzad - y[i+1]
- if (e[i+1] > hist): u[i+1] = uzad
- elif (e[i+1] < -hist): u[i + 1] = 0
- else:
- u[i+1] = u[i]
- return t, y, e, u
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement