Commit 5e03cbb7 authored by Luhan Wang's avatar Luhan Wang

rename file

parent 41029b71
from modules.Memristor import Memristor
from modules.memristor import Memristor
if __name__ == '__main__':
memr = Memristor(1, 1, "Gaussian")
......
import random
import numpy as np
class Memristor:
def __init__(self, ratio, noise_param, noise_pattern="Gaussian"):
self.ratio = ratio
self.noise_param = noise_param
self.noise_pattern = noise_pattern
def multiply(self, inputV, controlV):
precise_ret = inputV * (self.ratio / controlV) ## 这里描述了忆阻器特性,请根据实际情况修改
print(precise_ret)
if self.noise_pattern == "Gaussian":
ret = np.random.normal(precise_ret, self.noise_param, size=None)
else:
ret = precise_ret
return ret
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment