# lt SPICE: How to show the center frequency in the error log (of a band-filter) in ac sweep using .meas?

I'm trying to measure the center frequency of band pass fillter. And use

.meas maxGain MAX V(Xo)/V(xi)

I can get the max gain easily.

But I cannot find a way to get the frequency at the max gain point. I tried

.meas AC res FIND frequency AT V(Xo)/V(Xi)=0dB

.meas AC res FIND frequency AT V(Xo)=108.8m

The log shows: res: frequency=(-1.#INFdB,0? at 0

How to solve it?

Here is one way to do it. (V(a) used instead of the ratio, for simplicity)

For a good tutorial on the MEASURE command, join the groups.io LTSpice group, and look in Files / z_yahoo / Tut / MEASURE

• To the OP: note how Eamon used mag() for checks, and how maxGain is multiplied by 0.99999. The last part has to do with rounding. Finding the BW like this might not work for ripples in passband (e.g. Chebyshev), in which case you might have to measure the BW as two separate freqs, .meas f1 find freq when mag(v(a))=maxGain/10**(Ap/20) cross=first and cross=last for f2, then use .meas bw param f2-f1 and .meas fc param sqrt(f1*f2). Don't forget about .opt meascplxfmt=cartesian for results not in dB, and the nr. of points/dec (.AC is fast, 1k pts is safe to use). Commented Oct 29, 2020 at 8:19
• Thanks for the extra detail. TBH I cheated by looking in the tutorial that I referenced... .MEAS syntax is practically undocumented in the official help, so looking at the tutorial is the best way to find a particular recipe. Commented Oct 30, 2020 at 0:17
• Many thanks in advance! I'll try soon!
– FNJU
Commented Oct 30, 2020 at 5:52
• @Eamon Well, it is documented, but in the general spartan tone of the whole manual. Though the 0.999... part comes through practice. Commented Oct 30, 2020 at 7:43
• @Eamon Sorry it's a little weird I cannot see the pics in your answer now... would you please post it again (text would be better), thanks:)
– FNJU
Commented Oct 31, 2020 at 0:33