Skip to content
DeepForgeby svx
All problems
MediumCalculusca-178

Bode Magnitude at Frequency

Problem

For the first-order low-pass transfer function H(s) = k / (s + a), the magnitude at frequency omega is |H(j*omega)| = k / sqrt(omega^2 + a^2).

Return the magnitude in decibels: 20*log10(|H|). Assume k > 0 and a >= 0.

Hint

At the corner frequency omega = a the magnitude drops by about 3 dB.

Test cases

case 1
in: [1,1,0]
expected: 0
case 2
in: [1,1,1]
expected: -3.0102999566398125
case 3
in: [10,1,0]
expected: 20
case 4
in: [1,0,2]
expected: -6.020599913279624
case 5
in: [2,3,0]
expected: -3.521825181113625
Starter codePython
def bode_magnitude_db(k, a, omega):
    # Your code here
    pass

5 test cases · run your code against them in the editor