-
Notifications
You must be signed in to change notification settings - Fork 1
/
grafico_gamma_F.py
61 lines (48 loc) · 1.45 KB
/
grafico_gamma_F.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 11 12:33:04 2018
@author: booort
"""
import numpy as np
import matplotlib.pyplot as plt
from math import exp, log
import matplotlib.path as mpath
#code for the creation of the gama\F(k,gamma) graph
def F(k,gamma):
"""
Equation that give the theoretical approximation of the fraction loops thata
are feddback loops
k= loop length
gamma= parameter
returns the result
"""
return 2*exp(k/2*log(gamma*(1-gamma))+k/24*(log(gamma/(1-gamma)))**2)
fig = plt.figure()
i=2
prediction=[]
for gamma in range(1,10):
prediction.append(F(i,gamma/10))
plt.plot([0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9],prediction, '--r', marker="o", markersize=7,label="k=2")
i=3
prediction=[]
for gamma in range(1,10):
prediction.append(F(i,gamma/10))
plt.plot([0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9],prediction, '--b', marker="o", markersize=7,label="k=3")
i=4
prediction=[]
for gamma in range(1,10):
prediction.append(F(i,gamma/10))
plt.plot([0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9],prediction, '--g', marker="o", markersize=7,label="k=4")
i=5
prediction=[]
for gamma in range(1,10):
prediction.append(F(i,gamma/10))
plt.plot([0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9],prediction, '--y', marker="o", markersize=7,label="k=5")
#plotting
ax = fig.add_subplot(111)
ax.set_title('Grafica comparativa')
ax.set_xlabel(r'$\gamma$')
ax.set_ylabel(r'$F(k,\gamma$')
plt.legend()
plt.show()