分叉图(Bifurcation)

Logistic

#-*-coding:utf-8-*-
import numpy as np
import matplotlib.pyplot as plt


def logistic(u,x):
    x1 = u*x*(1-x)
    return x1


if __name__ == '__main__':
    listu=[]
    listx=[]

    for u in np.arange(0, 4.01, 0.01):
        x = 0.132456
        print(u)
        for i in range(1, 500):
            x1 = logistic(u,x)
            x=x1
            if i > 200:
                listu.append(u)
                listx.append(x)
    fig = plt.figure()
    ax1 = fig.add_subplot(111)
    plt.title('Logistic Bifurcation')
    plt.tick_params(labelsize=12)
    # 设置X轴标签
    plt.xlabel(r'$a$',fontsize=15)
    # 设置Y轴标签
    plt.ylabel(r'$x_n$',fontsize=15)
    plt.grid(True)
    ax1.xaxis.set_major_locator(plt.MultipleLocator(0.1))  # 设置x主坐标间隔 1
    ax1.scatter(listu, listx, c='b', marker='.', s=1)
    plt.show()

分叉图(Bifurcation)_第1张图片

你可能感兴趣的:(混沌密码学)