+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Member level 3
    Points: 437, Level: 4

    Join Date
    Jan 2018
    Posts
    56
    Helped
    2 / 2
    Points
    437
    Level
    4

    Measure bode plot in LTspice?

    Hello, my problem it's a bit complicated.

    I want to measure the magnitude (in dB) of the bode plot of a specific frequency after an AC analysis.

    In my configuration:

    1) I have a circuit (a simple low pass or an high pass filter)
    2) I change with the command STEP the value of a resistor
    3) For the resistor values where (X)Hz is higher than (Y)dB save the resistor value in the Error Log

    It's possible to do with MEAS command combined with STEP param and automate LTspice?

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 28,092, Level: 40
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,391
    Helped
    1058 / 1058
    Points
    28,092
    Level
    40
    Blog Entries
    6

    Re: Measure bode plot in LTspice?

    For the resistor values where (X)Hz is higher than (Y)dB save the resistor value in the Error Log
    For sure, you can also use the LTspice IF() command to check that condition.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



    •   AltAdvertisment

        
       

  3. #3
    Member level 3
    Points: 437, Level: 4

    Join Date
    Jan 2018
    Posts
    56
    Helped
    2 / 2
    Points
    437
    Level
    4

    Re: Measure bode plot in LTspice?

    Quote Originally Posted by andre_teprom View Post
    For sure, you can also use the LTspice IF() command to check that condition.
    Yes I know the IF statement but I don't know the syntax for the specific case. How to first of all, (Y)dB at (X)Hz? Then how to save the resistor with MEAS?
    Last edited by northumber82; 29th November 2018 at 15:03.



    •   AltAdvertisment

        
       

  4. #4
    Super Moderator
    Points: 28,092, Level: 40
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,391
    Helped
    1058 / 1058
    Points
    28,092
    Level
    40
    Blog Entries
    6

    Re: Measure bode plot in LTspice?

    By typing the CTRL+L keys you can view the file with the measured values for each simulation step.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



  5. #5
    Advanced Member level 2
    Points: 4,071, Level: 15

    Join Date
    Feb 2014
    Posts
    526
    Helped
    191 / 191
    Points
    4,071
    Level
    15

    Re: Measure bode plot in LTspice?

    In what context do you press 'ctrl+L'?

    If you run an AC sim at only one frequency it pops up a text file with a report of every node rather than a graph.

    LTSpice has a lot of interesting and not well documented tricks....



    •   AltAdvertisment

        
       

  6. #6
    Member level 3
    Points: 437, Level: 4

    Join Date
    Jan 2018
    Posts
    56
    Helped
    2 / 2
    Points
    437
    Level
    4

    Re: Measure bode plot in LTspice?

    CTRL+L show the error log.

    I found how to display the magnitude and phase of every run at specific frequency with this command:

    Code:
    .MEAS ac Vo V(out) at=Freq
    How now to implement the IF (Y)dB is > N?

    I found db(x) to get decibel variabile, and done command like this:

    Code:
    .MEAS ac Vo V(out) at=Freq WHEN db(Vo)>N
    But says failed. It's not documented how to use this syntax



  7. #7
    Full Member level 3
    Points: 1,205, Level: 7

    Join Date
    Aug 2016
    Posts
    174
    Helped
    22 / 22
    Points
    1,205
    Level
    7

    Re: Measure bode plot in LTspice?

    Let's try something different.

    Have a voltage source named vRfilter. The voltage source should have its positive terminal connected to a net label named "Rfilter". The net should be of type output. The negative terminal of the voltage source should be connected to GND. The value of the resistor in the value should be "R=V(Rfilter)". Now step this voltage instead of the resistor you stepped before.

    Let your measurement command be as follows:
    .meas R_cross find V(Rfilter) when Mag(v(y)/v(x))=5.

    NOTE: Replace 5 with the dB value the you want to measure. With this error log report, you should be able to know intuitively which values of Rfilter yield higher magnitude and which yield lower. They mustn't be in the error log. Or must they?

    It would be better to show your schematic so we see where you are placing your small-signal source and guide accordingly.

    I hope this works.
    Last edited by Akanimo; 30th November 2018 at 19:08.
    -------------
    --Akanimo.



--[[ ]]--