【问题标题】:How do I plot an asymptote如何绘制渐近线
【发布时间】:2021-12-15 13:44:14
【问题描述】:

您好,我是编码新手,并试图在 python 中的 y=x 处绘制一个渐近线,其中我的 y 和 x 都是函数

import NumPy as np
#define t

t=np.linspace(0.1,10,1000)

#define x

x=(4/3)*t+(np.cos(13*t))/t

#define y

y=(4/3)*t+(np.sin(13*t))/t

#imprort mat plot

import matplotlib.pyplot as plt

#plot the graphs
plt.plot(x,y,'g--')

#make the graph look nice
plt.title('x(t) versus y(t)')

plt.xlabel('x(t)')

plt.ylabel('y(t)')

如何在y=x 处绘制这条曲线的渐近线?

【问题讨论】:

    标签: python numpy


    【解决方案1】:

    如果您想绘制y=x 线,那么就可以了

    plt.plot(x,x)
    

    【讨论】:

      【解决方案2】:

      也许你错过了plt.show()

      import numpy as np
      t=np.linspace(0.1,10,1000)
      
      #define x
      
      x=(4/3)*t+(np.cos(13*t))/t
      
      #define y
      
      y=(4/3)*t+(np.sin(13*t))/t
      
      #imprort mat plot
      
      import matplotlib.pyplot as plt
      
      #plot the graphs
      plt.plot(x,x,'g--')
      
      #make the graph look nice
      plt.title('x(t) versus y(t)')
      
      plt.xlabel('x(t)')
      
      plt.ylabel('y(t)')
      plt.show()
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-08-20
        • 1970-01-01
        • 1970-01-01
        • 2015-07-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多