2 from matplotlib
import pyplot
as plt
4 import matplotlib
as mpl
6 plt.rcParams[
"svg.fonttype"] =
"none" 7 plt.rcParams[
'font.size'] = 16
9 mpl.rcParams[
"savefig.directory"] =
"../../Figures" 20 self.
y = np.linspace(start = -10, stop = 10, num =1000)
27 length_of_phi = len(self.
phi)
28 if(length_of_phi % 2 == 0):
29 self.
phi[int(length_of_phi/2 - 1)] = -1*self.
F_0 30 self.
phi[int(length_of_phi/2)] = 1*self.
F_0 32 self.
y[int(length_of_phi/2 - 1)] = 0
33 self.
y[int(length_of_phi/2)] = 0
35 self.
phi[int((length_of_phi-1)/2) -1] = -1*self.
F_0 36 self.
phi[int((length_of_phi-1)/2)] = 1*self.
F_0 38 self.
y[int((length_of_phi-1)/2 - 1)] = 0
39 self.
y[int((length_of_phi - 1)/2)] = 0
43 y_bigger_than_zero = np.linspace(start = 0.001, stop = 10, num = 1000)
44 y = np.hstack((np.array([0,0]), y_bigger_than_zero))
45 phi = np.hstack((np.array([-2, 1]), ((1 - sigma)/(1 + np.abs(y_bigger_than_zero)/(1 - sigma)) * np.sign(y_bigger_than_zero))))
47 fig, ax = plt.subplots()
48 ax.axhline(y=0, color =
'k')
49 ax.axvline(x=0, color =
'k')
50 ax.plot(y, phi, label =
"Friction Law")
56 ax.set_ylabel(
"$\phi(y)$")
65 plt.plot(self.
y, self.
phi)
66 plt.ylabel(
"\$\phi(y)\$")
69 plt.savefig(
"../../Figures/Master/Friction_law_demo.svg", format=
"svg")
75 friction.plotFrictionLaw()
76 friction.frictionLawCarlson()
78 if __name__ ==
"__main__":
def plotFrictionLaw(self)
def setMidPointsToOne(self)
def frictionLawCarlson(self)