Update README.md
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
parent
b99f1f1a0b
commit
035b658710
1 changed files with 35 additions and 0 deletions
|
@ -4,3 +4,38 @@
|
||||||
Sometimes we need to remove of frequency range from a time series. For this we can use a Butterworth filter [scipy.signal.butter](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html) and the [scipy.signal.filtfilt](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html) command.
|
Sometimes we need to remove of frequency range from a time series. For this we can use a Butterworth filter [scipy.signal.butter](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html) and the [scipy.signal.filtfilt](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html) command.
|
||||||
|
|
||||||
Questions to [David Rotermund](mailto:davrot@uni-bremen.de)
|
Questions to [David Rotermund](mailto:davrot@uni-bremen.de)
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| ------------- |:-------------:|
|
||||||
|
| [scipy.signal.filtfilt](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html) | Apply a digital filter forward and backward to a signal. |
|
||||||
|
| [scipy.signal.butter](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html) | Butterworth digital and analog filter design. |
|
||||||
|
|
||||||
|
## Example data
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
samples_per_second: int = 1000
|
||||||
|
dt: float = 1.0 / samples_per_second
|
||||||
|
|
||||||
|
# 10 secs
|
||||||
|
t: np.ndarray = np.arange(0, int(10 * samples_per_second)) * dt
|
||||||
|
|
||||||
|
f_low = 1 # Hz
|
||||||
|
f_mid = 10 # Hz
|
||||||
|
f_high = 100 # Hz
|
||||||
|
|
||||||
|
sin_low = np.sin(2 * np.pi * t * f_low)
|
||||||
|
sin_mid = np.sin(2 * np.pi * t * f_mid)
|
||||||
|
sin_high = np.sin(2 * np.pi * t * f_high)
|
||||||
|
|
||||||
|
plt.figure(1)
|
||||||
|
plt.plot(t, sin_low)
|
||||||
|
plt.plot(t, sin_mid + 3)
|
||||||
|
plt.plot(t, sin_high + 6)
|
||||||
|
plt.xlabel("Time [s]")
|
||||||
|
plt.ylabel("Waveform shifted")
|
||||||
|
plt.title("unfiltered data")
|
||||||
|
plt.show()
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue