用代码写画一个指数函数的图像
时间: 2024-05-08 08:19:32 浏览: 116
python实现画出e指数函数的图像
5星 · 资源好评率100%
Sure, here is the code to plot an exponential function in Python using matplotlib:
```python
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-5, 5, 1000)
y = np.exp(x)
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('y')
plt.title('Exponential Function')
plt.show()
```
This will plot the graph of the exponential function `y = e^x` on the x-axis ranging from -5 to 5.
阅读全文