0

The graph I'm getting of the function v(t) using matplotlib.pyplot as plt and plt.plot(t_test, vel) is not giving me what it is supposed to. Here is the full code and the resulting plot:

import numpy as np
import matplotlib.pyplot as plt

t_test = np.linspace(0,1,200)

def v(t):
    return 1500*(350/2000000) - (350/2000000)*np.log(1-0.00625*t)

vel = v(t_test)

print(vel)
plt.plot(t_test, vel)
plt.show()

enter image description here

The seemingly linear graph is certainly expected since values of t_test are between 0 and 1, so we're only seeing a small portion of the graph. My issue, however, is that the graph is showing v(0) = 0 when in fact, v(0) = 0.2625. Why do I have this discrepancy?

change_picture
  • 135
  • 1
  • 8

1 Answers1

2

In fact, it seems to me that you have a correct answer but I think that you didn't realize the y-scale. If you see the top of Y axis, there is 1e-6+2.6250000000e-1, this means that the value that you have on the Y axis you have to multiply by 1e-6 ( i.e. 10^-6) and sum 2.6250000000e-1 ( i.e. 0.2625). So, v(0)=0*(10^-6) + 0.2625 =0.2625.

Dharman
  • 30,962
  • 25
  • 85
  • 135