-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamic2.py
More file actions
28 lines (24 loc) · 819 Bytes
/
Dynamic2.py
File metadata and controls
28 lines (24 loc) · 819 Bytes
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
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 12 21:30:41 2018
@author: L
"""
import matplotlib.pyplot as plt
def drawCurve(a,CurrentLevel):#a即前文中的系数a,CurrentLevel即Xn
RegentLevel = []
for i in range(30):
RegentLevel.append(CurrentLevel)
CurrentLevel = (a*CurrentLevel-a*(CurrentLevel**2) )
Time = [i for i in range(30)]
#plt.plot(Time, RegentLevel)
#plt.scatter(Time, RegentLevel)
plt.hist(RegentLevel,bins = 100)
factor = [1.5, 2.5, 3, 3.4, 3.5, 3.8]
for j in factor:
for i in range(1,100):
drawCurve(j,i/100)
plt.annotate('a = ' + str(j),xy = (5, 0.4),xytext = (6,0.9),
arrowprops = dict(facecolor = 'black',shrink = 0.02))
plt.xlabel('time')#X轴标签
plt.ylabel('RegentLevel')#Y轴标签
plt.show()