Closed SnowCharmQ closed 3 months ago
@SnowCharmQ For JDSP, you do not need to divide the cut-off frequencies by the Nyquist frequency. Simply passing the cutoff frequencies to the function is sufficient.
So you need to use:
fun bandpass(
signal: DoubleArray,
sampleRate: Int,
lowFreq: Double,
highFreq: Double,
order: Int
): DoubleArray {
val nyquist = sampleRate / 2
val low = lowFreq
val high = highFreq
val butterworth = Butterworth(sampleRate.toDouble())
return butterworth.bandPassFilter(signal, order, low, high)
}
@SnowCharmQ For JDSP, you do not need to divide the cut-off frequencies by the Nyquist frequency. Simply passing the cutoff frequencies to the function is sufficient.
So you need to use:
fun bandpass( signal: DoubleArray, sampleRate: Int, lowFreq: Double, highFreq: Double, order: Int ): DoubleArray { val nyquist = sampleRate / 2 val low = lowFreq val high = highFreq val butterworth = Butterworth(sampleRate.toDouble()) return butterworth.bandPassFilter(signal, order, low, high) }
Thank you for your kind reply. I have already obtained the correct result.
I used jdsp (Kotlin) for signal bandpass and bandstop processing. And I implemented a util function like the documentation as shown below:
However, when I used Python Scipy library for comparison, I found that their results were inconsistent. The Python Scipy implementation is shown below:
Can you give me an explanation or just let me know how to reproduce the result from Python using jdsp?