Ich möchte für eine einfache Gleichung Richtungsfeld zeichnen:Plotten Richtungsfeld in Python
y' = 3 − 2y
Ich habe ähnliches Matlab Problem here (1.3) gefunden. Aber ich weiß nicht, wie ich es in Python umschreiben soll. Mein letzter Versuch ist:
from matplotlib.pyplot import cm
import matplotlib.pyplot as plt
import numpy as np
nx, ny = .3, .3
x = np.arange(-3, 3, nx)
y = np.arange(-2, 2, ny)
X, Y = np.meshgrid(x, y)
dy = X + np.sin(Y)
dx = np.ones((10,10))
plot2 = plt.figure()
plt.quiver(X, Y, dx, dy,
color='Teal',
headlength=7)
plt.title('Quiver Plot, Single Colour')
plt.show(plot2)
Aber ich bin immer Fehler:
builtins.ValueError: operands could not be broadcast together with shapes (100,) (280,)
ich, obwohl es sehr einfach sein, aber nach wenigen Stunden der Suche, wie man ein einfaches Richtungsfeld zu zeichnen, ich bin ziemlich deprimiert.