Electronic – how to position precisely the cursor in a bode diagram with LtSpice

ltspice

I'm using Ltspice, and when I have a bode diagram, I have a cursor.

I'm able to move the cursor over whatever value I'm using. However, sometime I need a precise frequency. When I try to enter it in the box, it appears to be locked.

As a side question, would it be possible to make the cursor go to the maximum peak?

Best Answer

I'm not aware of a way to do so. It might be noteworthy, that the lines you see are actually an interpolated view of the datapoints, so you only have a limited collection of data points available.

You can view the available data points via right click and Mark Data Points

result with data points visible

You can navigate your cursor to the next data point using the left and right arrow key on your keyboard.

If you just want to determine a maximum value, you can use a .MEASURE directive. (Use the .op button to place a custom directive on the schematic)

For example:

.measure AC res1 MAX mag(V(out))

Where:

  • AC is the type of the simulation on which the result has to be taken
  • res1 is the name of the result
  • MAX indicates to find the maximum
  • mag() is for looking for the magnitude (in AC we have complex results)
  • V(out) is the expression on which it should find the maximum

The results are available (oddly) in the Spice Error Log (View -> Spice Error Log or CTRL+L).

You'll find a line like:

res1: MAX(mag(v(out)))=(-0.0171115dB,-3.59527°) FROM 1 TO 100000

Now that doesn't give you the frequency at which this maximum is reached.

To do that, you need another .measure:

.measure AC res2 when mag(V(out))=res1

What's happening here? It measures the time (or frequency) when the condition is true. So basically you ask "at what point is the magnitude of the output voltage equal to the res1", res1 contains the maximum of the magnitude, so you ask for the point where it reaches the maximum.

And you will get:

res2: mag(v(out))=res1 AT 1

It's not possible to do it with just one .measure statement.