I want to synthesize this simple analog audio filter which is a notch:

enter image description here

The inductor with resistor creates a simple one-pole low pass filter with the cutoff frequency at:

fc = 1/(2pi L R)

The capacitor with the resistor creates a one-pole high pass filter with the cutoff freq at:

fc = 1/(2pi C R)

So is synthesizing this circuit as simple as just running the input through both filters and summing it together?



output = onePoleHPF.process(input) + onePoleLPF.process(input);

Or is it not really that simple? Do I need to "weight" their contributions or gain scale them somehow to ensure I'm not adding gain at any overlapping frequency? If so, in what proportion? Like

output = onePoleHPF.process(input * 0.5) + onePoleLPF.process(input * 0.5);

I think one of these two approaches is correct because parallel elements share the same voltage across them so I think the input voltage is just split 50/50 between the two pathways.

Or will this not work and I need to create a completely new filter to get the right output? If so, how would I get a transfer function to make this work?

EDIT this is inserted after I got an answer from user287001:

The answer was what I needed.

The principles I used come from: https://www.dsprelated.com/freebooks/pasp/String_Excitation.html. If I have two resistors in series of identical impedance at that point instead of one resistor (more accurate for my simulation) like this:

enter image description here (Sim from https://www.falstad.com/afilter/)

Then the equation becomes:

\$V_o(s) = V_i(s) * \frac{2R}{2R+\frac{1}{\frac{1}{sL} + sC}}\$

Substituting \$s = \frac{1-z^{-1}}{T}\$ where T is the sampling period and having Wolfram Alpha simplify:

\$V_o(z) = \frac{2 R V_i(z) (C L z^{-2} - 2 C L z^{-1} + C L + T^{2})}{2 C L R z^{-2} - 4 C L R z^{-1} + 2 C L R - L T z^{-1} + L T + 2 R T^{2}}\$

Multiplying both sides out I get:

\$2CLRV_o[n-2] - 4CLRV_o[n-1]-TLV_o[n-1] + 2CLRV_o[n] + TLV_o[n] + 2RT^{2}V_o[n] = 2R (V_i[n-2]CL-2CLV_i[n-1] + V_i[n]CL + V_i[n]T^{2})\$

Then to isolate for \$V_o[n]\$:

\$V_o[n] = \frac{2R (V_i[n-2]CL - 2CLV_i[n-1] + V_i[n]CL + V_i[n]T^{2}) - 2CLRV_o[n-2] + 4CLRV_o[n-1] + TLV_o[n-1]}{2CLR + TL + 2RT^{2}}\$

Does that look correct? Thanks a bunch.

  • 1
    \$\begingroup\$ What do you mean by synthesise? \$\endgroup\$
    – Andy aka
    Dec 26 '19 at 11:05
  • \$\begingroup\$ Two 500mOhm resistor in series is the same as a 1Ohm resistor, therefore the calculation should not change at all, and it leads to unnecessary complications. The notch frequency is determined by the LC resonance, and the depth of the notch is determined by the effective parallel resistance of the resonator at resonance, which forms a voltage divider together with the 1Ohm load at the output. \$\endgroup\$ Dec 26 '19 at 22:55
  • \$\begingroup\$ What makes you think 1 mH choke is practical with DCR < 1 Ohm \$\endgroup\$ Dec 27 '19 at 1:47
  • \$\begingroup\$ This is for an audio synthesis electronic equivalent circuit. It is not actually for filtering in any normal sense. It is designed this way based on the principles in dsprelated.com/freebooks/pasp/String_Excitation.html \$\endgroup\$
    – mike
    Dec 27 '19 at 10:45

Sorry, but it's wrong. The current through L depends on what's gone through C, it cannot be divided to 2 independent circuits like you have done. It must be calculated all parts together. You should use a software function which lets you input the right transfer function.

Start by learning to do the analysis manually to find the right transfer function. Understanding phasor calculus with complex numbers and s-domain impedances are the basics.

I guess you need the notch filter functionality to process signals, not a simulation of the drawn LC filter. I'm sure the filtering is possible more effectively by using filter synthesis methods for DSP without dragging along L nor C.

ADD: A comment shows that the guess was wrong. The circuit can be worked as a voltage divider, but the upper resistor is replaced by L and C in parallel. Here's the transfer function, simplify it algebraically to the form that you can input.

enter image description here

If it happens that you cannot cope with impedances sL and 1/sC, you have several months of studies in front of you or you must get an electrician to assist.

ADD2 after the question was augmented:

For me z=exp(sT). Your version z=1/(1-sT) can probably be used in some cases. I'm not so good with z-transforms that I can say what errors you introduce. It's a kind of first order approximation and it can work if T<<1/(2Pi*signal frequency).

  • \$\begingroup\$ Thanks. Okay. So it's not so easy. I will need a simulation of the circuit as it is for physical modeling synthesis and I am modeling a real world phenomenon with an equivalent electrical circuit. I'll need a transfer function based on the C, R, and L values. I guess I'll have to figure out how to do that or find someone who knows how. \$\endgroup\$
    – mike
    Dec 26 '19 at 9:21
  • \$\begingroup\$ @mike More realistic would be to follow voltages and currents with state transition equations which can be solved easily numerically. You simply run the model with short enough timesteps. One thing needs still some clearance: How did you decide that this LC filter has mathematical analoque with a physical world phenomena which you want to simulate? \$\endgroup\$
    – user287001
    Dec 26 '19 at 16:28
  • \$\begingroup\$ Thanks. That's exactly what I needed. The principles come from: dsprelated.com/freebooks/pasp/String_Excitation.html I have posted a new answer based on your answer to find the discrete time sample-based transfer function. Can you take a look if you have a moment and see if I interpreted everything correctly? It would be greatly appreciated. I'm new to all this and just learning as I go. \$\endgroup\$
    – mike
    Dec 26 '19 at 18:19
  • \$\begingroup\$ Great @user287001 , if I got that application right, looks like everything is done then. \$\endgroup\$
    – mike
    Dec 26 '19 at 21:27
  • \$\begingroup\$ No worries thanks. I know it's the backward Euler substitution method and it typically works okay. To be honest I'm not actually sure when to use backward Euler, forward Euler, or Tustin. But I'll just give it a go and see what happens. \$\endgroup\$
    – mike
    Dec 26 '19 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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