Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. def symulacja_histereza(a, uzad, y0, yzad, T, h, hist):
  2. t = np.arange(0, T, h)
  3. y = np.zeros(t.shape[0])
  4. e = np.zeros(t.shape[0])
  5. u = np.zeros(t.shape[0])
  6.  
  7. y[0] = y0
  8. e[0] = yzad - y0
  9. if(e[0]>0): u[0]=uzad
  10. else: u[0]=0
  11.  
  12. for i in range(t.shape[0]-1):
  13. y[i+1] = y[i] + h*(a*y[i]+u[i])
  14. e[i+1] = yzad - y[i+1]
  15. if (e[i+1] > hist): u[i+1] = uzad
  16. elif (e[i+1] < -hist): u[i + 1] = 0
  17. else:
  18. u[i+1] = u[i]
  19. return t, y, e, u
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement