Skip to content Skip to sidebar Skip to footer

How Can I Plot A Mathematical Expression Of Two Variables In Python?

I have a time- and depth-varying function, simplified to: def f(z,t): return np.exp(-z)*np.sin(t-z) z = np.linspace(0,3000,num=3001) t = np.arange(0,40000,4000) I want to plo

Solution 1:

import matplotlib.pyplot as plt
import numpy as np

def f(z,t):
    return np.exp(-z)*np.sin(t-z)

z = np.linspace(0,5,3001)
t = np.arange(0,40000,4000)

for tval in t:
    plt.plot(z, f(z, tval))
plt.show()

enter image description here


Post a Comment for "How Can I Plot A Mathematical Expression Of Two Variables In Python?"