python - Python:如何绘制 y=cosh(x) *cos(5x)
问题描述
使用 Python 我想在我的 Jupyter Notebook 中为函数 y=cosh(x)*cos(5x) 绘制曲线。
换句话说:(x 的余弦双曲线)乘以(5x 的余弦)
我该怎么做呢?我需要导入什么?非常感谢您提前。
问候
解决方案
指定所需的 x 值范围。您可以在 Matplotlib 之上使用 Seaborn 使其更漂亮,但这是可选的:
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-5,5,0.1) # start,stop,step
y= (np.cosh(x))*(np.cos(5*x) )
# set a grey background (use sns.set_theme() if seaborn version 0.11.0 or above)
sns.set(style="darkgrid")
plt.plot(x,y)
plt.show()
推荐阅读
- ruby-on-rails - 活动存储 - 阻止下载 - 尽可能在浏览器中打开文件
- angular - 量角器中的 404 用于已知工作的非根 Angular 页面
- python-3.x - 在一张图中绘制三个数据库 Python
- python - 有没有办法在不改变图像的情况下将灰度图像转换为 RGB 图像?
- java - 在java中创建每天在特定时间运行的Kafka流
- ruby-on-rails - 如何让rails逐块从aws s3中获取数据并将其作为pdf下载文件发送到ti浏览器?
- google-cloud-platform - Google Cloud Run / 域映射是否支持 ALIAS 记录?
- java - 在 Sugeno 方法上使用 java 和 jfuzzylogic 库
- sql - 需要按季度明智地显示过去 12 个月的数据
- c# - 根据c#中的行号获取文本文件中字符串的位置