anaconda安装
https://blog.csdn.net/weixin_43715458/article/details/100096496
pycharm安装
https://www.runoob.com/w3cnote/pycharm-windows-install.html
接下来就是给石头姐写的python作图程序啦
目的:画出两个正太分布图像
import math
import numpy as np
import matplotlib.pyplot as plt
u_1 = 24 # 均值u_1
sig_1 = math.sqrt(36) # 标准差sigma_1
# 这个是开汽车的时间概率密度分布
u_2 = 36 # 均值u_2
sig_2 = math.sqrt(4) # 标准差sigma_2
# 这个是骑车的时间概率密度分布
t = np.linspace(0, 70, 200) # 定义域,从0到70,间隔200个点
x = np.exp(-(t - u_1) ** 2 / (2 * sig_1 ** 2)) / (math.sqrt(2 * math.pi) * sig_1) # 定义曲线函数
y = np.exp(-(t - u_2) ** 2 / (2 * sig_2 ** 2)) / (math.sqrt(2 * math.pi) * sig_2) # 定义曲线函数
plt.plot(t, x, "g", linewidth=2, label='X-car') # 加载X曲线,使用绿色表示
plt.legend() # 显示图例
plt.plot(t, y, "r", linewidth=2, label='Y-ride') # 加载Y曲线,使用红色表示
plt.legend() # 显示图例
plt.grid(True) # 网格线
plt.show() # 显示
把这些代码塞进去,运行一下就好了
鼠标右键,run!就好