Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

计算RMS的时候,为什么要乘以2 #3

Open
happyfsyy opened this issue Sep 11, 2023 · 1 comment
Open

计算RMS的时候,为什么要乘以2 #3

happyfsyy opened this issue Sep 11, 2023 · 1 comment

Comments

@happyfsyy
Copy link

private fun calRMS(left: Float) {
    if (sampleCount == perSamplePoints) {
        val rms = sqrt(sampleSum / perSamplePoints) * 2 // 0~1
        sampleData.add(rms.toFloat())
        sampleCount = 0
        sampleSum = 0.0
    }

    sampleCount++
    sampleSum += left.toDouble().pow(2.0)
}

第二行,rms=sqrt(sampleSum/perSamplePoints)*2,为什么要乘以2 ?

@stefanJi
Copy link
Owner

额,具体原因很久忘记了,可能就是为了放大下数据?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants