0

Hello,
I'm trying to plot this function with using this values:

Rh = 9.8    
H0 = 0.063 

def Thickness_H(H0, r, Rh): 
      return float(H0)*np.exp(float(r)/float(Rh))

r = np.linspace(0,1, 10)    
x =Thickness_H(H0, r, Rh)
plt.plot(r, x)
plt.show()

I'm trying to defind r like what i know but this dose not work, I'm getting this error:
only length-1 arrays can be converted to Python scalars.

may you please help me in this point?
Thank you

2
Contributors
6
Replies
32
Views
10 Months
Discussion Span
Last Post by ALosh99
Featured Replies
1

I don't understand your question. If you write return H0*np.exp(r/Rh), the code works and draws a curve, which is almost a straight line (I suppose it is because 1/Rh is small).

0

I want to plot this function

H0*np.exp(r/Rh)
I definded it, then I want to plot it, r is different values ? yes you are right I will get exponential curve?

Edited by ALosh99

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.