Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Incomplete transfer function for phase response

  1. Oct 4, 2009 #1
    Hi,

    I'm currently busy with a 'small' project of translating an analog device (synthesizer, based on schematics) into a digital counterpart.
    What I do is basically simulate the device using a SPICE model. Then I look at the outputs, and see if can fit some equation on it.

    Based on the mathematical approximation of the circuit's behaviour, I implement an algorithm/DSP that shows the same behaviour as the analog version.
    Now I've come to a small problem.

    The circuit shows something that is a 2nd order active high pass filter. In my SPICE model, I did an AC simulation to get the frequency response of this filter (gain), and the phase response.

    The next step was to find the transfer function for the filter. Well, that step already takes a week, so that's why this forum is my last resort, where I would like to show the problem. And hopefully someone has an answer.

    Okay, the problem is as follows:
    I use a standard transfer function for a 2nd order high pass filter:

    [tex]H(s) = \frac{s^2}{s^2 + \omega_0/Q s + \omega_0^2}[/tex]

    The following values give a perfect fit for the frequency response (ie gain, [tex]|H(s)|[/tex])
    [tex]\omega_0 = 228.711[/tex]
    [tex]Q = 1.58195[/tex]

    look!

    attachment.php?attachmentid=20926&stc=1&d=1254683685.png (freq_gain.png)

    But when you look at the phase response, there is no fit at all:

    attachment.php?attachmentid=20927&stc=1&d=1254683685.png (freq_phase.png)
    (the phase jumps 360 degrees at 51.5 Hz)

    So apparently, the transfer function is wrong or incomplete. Now my question is: how should the transfer function look like, to make sure both the measured frequency response and the measured phase response are perfectly captured in the equation?


    For your reference, here is the schematic that was simulated:


    attachment.php?attachmentid=20928&stc=1&d=1254683685.png (hpf.png)

    Thank you in advance for your help!
     

    Attached Files:

  2. jcsd
  3. Oct 4, 2009 #2

    berkeman

    User Avatar

    Staff: Mentor

    Welcome to the PF. Why is R4 there?
     
  4. Oct 4, 2009 #3

    berkeman

    User Avatar

    Staff: Mentor

    I guess maybe for the 2nd order transfer function? Can you link to the original circuit you are trying to simulate? (where did you get the original circuit?)
     
  5. Oct 5, 2009 #4
    Last edited by a moderator: Apr 24, 2017
  6. Oct 5, 2009 #5

    uart

    User Avatar
    Science Advisor

    That phase doesn't jump! Phase angle wraps around (-180 = +180) and sometimes programs cant handle this wrapping correctly. That phase plot smoothly decreases from +270 to zero as frequency increases, that's all.

    BTW. There is something else wrong with your plots. The green trace showing the phase of the stated transfer function should start at +180 and go to zero (not -180 to zero as shown).
     
    Last edited: Oct 5, 2009
  7. Oct 5, 2009 #6

    uart

    User Avatar
    Science Advisor

    One final note.

    If R4 were to have been connected to the output of the opamp (instead of the inverting input) then the circuit topology would have been precisely that of a second order high-pass "Sallen-Key" design. In this case you could just look up the transfer function of a Sallen Key filter and plug in the component values. As it is the circuit is a fair bit harder to analyse (but still do-able).

    BTW. "Sallen-Key" was a very popular (and somewhat a standard) topology for active filters back in a their day.
     
    Last edited: Oct 5, 2009
  8. Oct 5, 2009 #7
    gentlemen,

    your hints brought me back on the right track.

    it could be a lucky shot, but found that a small change to the transfer function would give a perfect fit:

    [tex]H(s) = \frac{s^2 + a s}{s^2 + \omega_0/Q s + \omega_0^2}[/tex]

    a new term has been added to the numerator: [tex]a s[/tex]

    The following values give a perfect fit for the frequency response and the phase response:
    [tex]\omega_0 = 228.711[/tex]
    [tex]Q = 1.58195[/tex]
    [tex]a = -7.72458[/tex]

    see attached plots

    Thanks
     

    Attached Files:

  9. Oct 5, 2009 #8

    uart

    User Avatar
    Science Advisor

    Hi kvtb, quick question. What software are you using? I think it may be leading you astray as I question whether that phase response belongs to either that circuit or that transfer function.

    Are you certain that the circuit diagram you posteed is the same one you're simulating?
     
  10. Oct 6, 2009 #9
    hello uart, I'm currently using qucs (http://qucs.sourceforge.net), but I'm considering re-simulating the same circuit in GNUcap just to be sure the software is not an issue here.

    I indeed think that the circuit I'm simulating is the same I've posted here. Because just by looking at the theory (Sallen-Key like you mentioned) I expect a high pass filter, and the Bode-plot output of the AC simulation show a high pass filter


    But yesterday I did a z-transform (manually) of the transfer function, then I implemented it, and I got a perfect.. low pass filter. So it's certain I made an error somewhere :smile:
     
  11. Oct 7, 2009 #10

    uart

    User Avatar
    Science Advisor

    Ok it mostly looks good. I still think that the "measured arg(H(s))" shown in green in your first post is the negative of what it should be, but the phase angle shown in red now looks good except for the "wrap around" issue.

    You should read that phase as a continuous decreasing function, starting at -90 degrees and finishing at -360 degrees. Remember that in the context of steady state AC analysis that multiples of 360 degrees are meaningless, so you can just as well read that phase as going from +270 degrees down to 0 degrees.

    BTW. It turns out that the circuit really is precisely a Sallen-Key HPF from Vin to the opamp input. I analysed it (by hand) and got the following transfer function.

    [tex]\frac{v_+}{v_{in}} = \frac{s^2} {s^2 + \frac{2}{R_2 C} s + \frac{1}{R_2 R_4 c^2} } [/tex]

    What makes the circuit different is that the op-amp is no longer just a simple gain of two, because of the contribution of the current through R4 you get a whole another frequency response just from the opamp input to opamp output. I didn't analyse that part fully but I'm now confident that it does indeed introduce another zero, exactly as you had empirically deduced in your last post.
     
  12. Oct 7, 2009 #11

    uart

    User Avatar
    Science Advisor

    Hang on. No there's still something bothering me about those results. I believe the results of the circuit simulation but I don't believe that the stated transfer fuction can give those phase results.

    I can tell you for absolute certain that

    [tex]H(s) = \frac{s^2 + a s}{s^2 + \omega_0/Q s + \omega_0^2}[/tex]

    will not give the phase response shown. There is abolutely no way that is going to give the 270 degrees phase shift as shown - just cant happen.

    Edit : I take that back. I was thinking that "a" was a positive constant. I only just noticed that you stated that "a" is negaive. That totally changes things, when "a" is negative then it does indeed give the phase response as indicated.
     
    Last edited: Oct 7, 2009
  13. Oct 7, 2009 #12

    uart

    User Avatar
    Science Advisor

    Still one thing that seems wrong. That circuit definitely has a gain of 2 (6dB) in the pass-band though the simulation shows zero dB. ???
     
    Last edited: Oct 7, 2009
  14. Oct 7, 2009 #13

    The Electrician

    User Avatar
    Gold Member

    I get a transfer function from V1 to opamp output of:

    [tex]\frac{Vo}{V1} =(1+\frac{R_1}{R_3}) \frac{s^2-\frac{R_1R_3}{(R_1+R_3)R_2R_4C_2}s} {s^2 + (\frac{1}{R_2 C_2}+\frac{1}{R_2C_1}) s + \frac{1}{R_2 R_4 C_1C_2} } [/tex]

    This circuit is a little unusual in that the right end of R4 is connected to the minus input of the opamp, rather than to the output of the opamp.

    I've attached two plots. The first shows the gain response of the given circuit in blue, and also the gain response if the right end of R4 were connected to the opamp output.

    The second plot shows the corresponding phase responses.
     

    Attached Files:

  15. Oct 7, 2009 #14

    uart

    User Avatar
    Science Advisor

    Yes I also analysed the TF from op-amp input to op-amp out last night to complete the overall response and got exactly the same answers as you "The Electrician". Good work. :)

    I got :

    [tex]\frac{v_{out}}{v_{in}} = \frac{2s (s - \frac{R}{2 R_2 R_4 C})} {s^2 + \frac{2}{R_2 C} s + \frac{1}{R_2 R_4 C^2} } [/tex]

    Where [itex]R[/itex] is [itex]R_1 = R_3[/itex] and [itex]C[/itex] is [itex]C_1 = C_2[/itex].

    The right half plane zero means it's not a "mininum phase" system. The numerator phase runs from +270 degress back to +180 degree (rather than from +90 through to +180 as it would in a minumum phase system).

    BTW The Electrician, do you have software to analyse the circuit or did you also analyse by hand. Just wondering as it seems like a dying art. I was starting to think that I'm the only one left alive that can still do stuff like that. ;)
     
    Last edited: Oct 7, 2009
  16. Oct 7, 2009 #15

    The Electrician

    User Avatar
    Gold Member

    I use a method involving admittance matrices.

    I explain it in this thread:

    http://forum.allaboutcircuits.com/showthread.php?t=26710
     
  17. Oct 10, 2009 #16
    @uart and The Electrician. As a non-EE I'm quite impressed by your analysis of the schematics.

    I'll try to perform a manual z-tranform based on the transfer functions you've supplied.
    Thank you.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook