„np.gradient“ weist eine hohe Varianz bei ungleichmäßigen Abständen aufPython

Python-Programme
Guest
 „np.gradient“ weist eine hohe Varianz bei ungleichmäßigen Abständen auf

Post by Guest »

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()
Image

Der Lärm in Die Daten scheinen um einiges verstärkt zu sein. Wie sollen wir damit umgehen?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post