In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pylab
pylab.rcParams['figure.figsize'] = (15.0, 15.0)

In [2]:
from matplotlib import rc
rc('font', size=18)

In [3]:
from Memristor import Memristor

In [4]:
SM2_TO_M2 = ((10**(-2))**2)
NM_TO_M = 10**(-9)

In [5]:
D = 10 * NM_TO_M
mu = (10**(-10)) * SM2_TO_M2
nu = 100
w0 = D / 10
R_ON = 1
R_OFF = R_ON * 160
U0 = 1

In [6]:
def U_sin(t, U0, nu):
    return U0 * np.sin(nu * t)

def Phi_sin(t, U0, nu):
    return U0 * (1 - np.cos(nu * t)) / nu

In [7]:
def U_sin_sqr(t, U0, nu):
    return U0 * (np.sin(nu * t) ** 2)

def Phi_sin_sqr(t, U0, nu):
    return U0 * (2 * nu * t - np.sin(2 * nu * t)) / (4 * nu)

In [8]:
m_sin1 = Memristor(D, mu, nu, w0, 160, 1, lambda t: U_sin(t, U0, nu), lambda t: Phi_sin(t, U0, nu))
m_sin2 = Memristor(D, mu, nu, w0, 380, 1, lambda t: U_sin(t, U0, nu), lambda t: Phi_sin(t, U0, nu))

In [9]:
m_sin1.task1(plt, 1000, 5)
m_sin1.task2(plt, 1000, 5)
m_sin1.task3(plt, 1000, 5)



In [10]:
m_sin2.task1(plt, 1000, 5)
m_sin2.task2(plt, 1000, 5)
m_sin2.task3(plt, 1000, 5)