完整代码请下载
# -*- coding: utf-8 -*-"""Created on Tue Jan 15 12:23:53 2019 @author: luogantt""" import numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dsigma=10.0r=28.0bb=8/3 h=0.004 #洛伦茨混沌系统def lorence(tp): x=tp[0] y=tp[1] z=tp[2] x1=x+h*(sigma*(y-x)) y1=y+h*(x*(r-z)-y) z1=z+h*(x*y-bb*z) return [x1,y1,z1] b=[[15.34,13.68,37.91]]for i in range(3000): temp=b[i] p=lorence(temp) b.append(p) b=np.array(b)plt.figure(figsize=(20, 12))ax = plt.subplot(111, projection='3d') # 创建一个三维的绘图工程# 将数据点分成三部分画,在颜色上有区分度ax.scatter(b[:,0], b[:,1], b[:,2], c='y') # 绘制数据点 ax.set_zlabel('Z') # 坐标轴ax.set_ylabel('Y')ax.set_xlabel('X')plt.show()完整代码请下载