daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top