How to plot $y(x)=4e^{\frac{-118300}{x}}$ in $[3000,25000]$ in python

38 Views Asked by At

I am new at python. I found this code for plotting $e^x$ in $[-2,2]$:

import matplotlib.pyplot as plt
import numpy as np

# 100 linearly spaced numbers
x = np.linspace(-2,2,100)

# the function, which is y = e^x here
y = np.exp(x)

# setting the axes at the centre
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.spines['left'].set_position('center')
ax.spines['bottom'].set_position('zero')
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')

# plot the function
plt.plot(x,y, 'y', label='y=e^x')
plt.legend(loc='upper left')

# show the plot
plt.show()

How can I plot $y(x)=4e^{\frac{-118300}{x}}$ in $[3000,25000]$ in python with this code?

1

There are 1 best solutions below

5
On BEST ANSWER

In line $5$, you can edit the range according to your convenience. Then, in line $8$, simply editing the RHS of the equality to your desired function should suffice to give you the desired result. I hope you know the syntax to typing out the code and all the little details.