positiveDifference static method
Computes the positive difference between two spectra, summing only the positive changes in magnitude across all frequency bins.
Implementation
static double positiveDifference(
List<double> current,
List<double> previous,
) {
if (current.length != previous.length) {
throw ArgumentError('Spectra must have the same length.');
}
double value = 0;
for (int i = 0; i < current.length; i++) {
final difference = current[i] - previous[i];
if (difference > 0) {
value += difference;
}
}
return value;
}