How to compute peak-to-peak values in Python using UliEngineering
You can easily compute the peak-to-peak value of a signal using the UliEngineering Python library:
peak_to_peak.py
import numpy as np
from UliEngineering.SignalProcessing.Utils import *
# Create a signal
signal = np.array([1.0, 2.0, 3.0, 4.0, 5.0])
# Compute peak-to-peak value
pp_value = peak_to_peak(signal)
print(f"Signal: {signal}")
print(f"Peak-to-peak value: {pp_value}")Example output
peak_to_peak_output.txt
Signal: [1. 2. 3. 4. 5.]
Peak-to-peak value: 4.0The peak_to_peak() function computes $\max(arr) - \min(arr)$, which is the difference between the maximum and minimum values in the signal.
Check out similar posts by category:
Signal Processing, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow