by Guest » 14 Jan 2025, 13:02
Ich habe eine hohe Varianz in np.gradient für relativ glatte Daten festgestellt.
Angenommen, wir möchten dx/dt berechnen:
Code: Select all
import numpy as np
import matplotlib.pyplot as plt
x = np.array([13.11149679, 13.2141427 , 13.37743691, 13.3934357 , 13.56163066,
13.60207566, 13.69304133])
t = np.array([0.73065159, 0.74012055, 0.75911018, 0.7607452 , 0.77811468,
0.78031837, 0.79046324])
x_grad = np.gradient(x, t)
plt.plot(t[1:], np.diff(x) / np.diff(t), 'xb', label="findiff")
plt.plot(t, x_grad, 'or', label = 'np.gradient')
plt.plot(t, x, '+g', label = "x")
plt.xlabel('t')
plt.ylabel('x')
plt.legend()
plt.show()
Der Lärm in Die Daten scheinen um einiges verstärkt zu sein. Wie sollen wir damit umgehen?
Ich habe eine hohe Varianz in np.gradient für relativ glatte Daten festgestellt.
Angenommen, wir möchten dx/dt berechnen:
[code]import numpy as np
import matplotlib.pyplot as plt
x = np.array([13.11149679, 13.2141427 , 13.37743691, 13.3934357 , 13.56163066,
13.60207566, 13.69304133])
t = np.array([0.73065159, 0.74012055, 0.75911018, 0.7607452 , 0.77811468,
0.78031837, 0.79046324])
x_grad = np.gradient(x, t)
plt.plot(t[1:], np.diff(x) / np.diff(t), 'xb', label="findiff")
plt.plot(t, x_grad, 'or', label = 'np.gradient')
plt.plot(t, x, '+g', label = "x")
plt.xlabel('t')
plt.ylabel('x')
plt.legend()
plt.show()
[/code]
[img]https://i.sstatic.net/0wBId.png[/img]
Der Lärm in Die Daten scheinen um einiges verstärkt zu sein. Wie sollen wir damit umgehen?