3
$\begingroup$

I'm trying to find the -3 dB frequency of a filter in Mathematica. Yet, my code doesn't seem to work as it produces imaginary values for the frequency.

Tfilter=(9.36*^6 + 44226.*s + 9.477*s^2)/(2.35521*^9 + 495801.*s + 9.477*s^2)
Eqn1 = 20*Log[10, Abs[Tfilter /. s -> I*2*Pi*f]] == -3
Solve[Eqn1, f]

What am I doing wrong? Is there any additional command I shall give to Mathematica?

$\endgroup$
3
  • $\begingroup$ FindRoot[Eqn1,{f,1}] instantly returns {f->7530.29} Please check that VERY carefully to make certain that is correct. Perhaps Plot[Log[10,Abs[Tfilter/.s->I*2*Pi*f]]+3/20,{f,0,10^4}] will give you some useful insight. $\endgroup$
    – Bill
    Commented Aug 22, 2020 at 2:20
  • $\begingroup$ @Bill thank you! Yes I have plotted the graph already so I knew the frequency was around that :) $\endgroup$ Commented Aug 22, 2020 at 2:27
  • 1
    $\begingroup$ This also does the job: Solve[Eqn1 && f \[Element] Reals, f] $\endgroup$
    – Akku14
    Commented Aug 22, 2020 at 8:19

1 Answer 1

6
$\begingroup$
Clear["Global`*"]

Tfilter = (9.36*^6 + 44226.*s + 9.477*s^2)/(2.35521*^9 + 495801.*s + 
       9.477*s^2) // Rationalize // Simplify;

Since f is real, use ComplexExpand to eliminate Abs

Eqn1 = 20*Log[10, Abs[Tfilter /. s -> I*2*Pi*f]] == -3 // ComplexExpand // 
   Simplify;

sol = Solve[Eqn1, f, Reals] // N

(* {{f -> -7530.29}, {f -> 7530.29}} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.