4
\$\begingroup\$

I would like to measure the resonant frequency automatically in LTspice, i.e. with the command ".meas" of the following waveform. Is it possible to do it by using the FFT plot? I have tried something, but it seems to me to be relatively complicated and I think there is a better way :)

enter image description here

Here is the schematic if it can help you.

enter image description here

Thank you very much and have a nice,

\$\endgroup\$
9
  • \$\begingroup\$ If you posted a schematic of what your circuit is, it's more likely to be explained. \$\endgroup\$
    – Andy aka
    Commented Aug 3, 2020 at 11:51
  • \$\begingroup\$ In the added schematic you have written in blue "resonant frequency = 15M87" and that is about right so, where did that expression come from and why can't you use it? \$\endgroup\$
    – Andy aka
    Commented Aug 3, 2020 at 12:15
  • \$\begingroup\$ Yeah this is the right frequency but I measured it thank to cursors and I do it manually ... \$\endgroup\$
    – Jess
    Commented Aug 3, 2020 at 14:17
  • \$\begingroup\$ But you can calculate it so easily from the values in your circuit - it's 15.915 MHz just by using simple calculations. How accurate do you need it to be? \$\endgroup\$
    – Andy aka
    Commented Aug 3, 2020 at 14:34
  • 1
    \$\begingroup\$ @Jess If you look in the help file, in LTspice > Circuit Elements > M. MOSFET, you'll see exactly how the VDMOS has the nonlinear capacitance modeled. \$\endgroup\$ Commented Aug 3, 2020 at 15:32

1 Answer 1

7
\$\begingroup\$

There are a few ways you could do it. One would be with the FFT. If you only need a quick result, you could simply perform an FFT analysis straight on the waveform, as it is. You'll see something like this:

FFT

This is the resultof a 1024 points FFT, without binomial smoothing. It's ugly, because no special care has been taken care of -- it's an exponentially decaying waveform, not an exact number of periods, compression is on, no imposed timestep, bla, bla -- for which the cursor reads 1.6Hz. Given the resolution, it's close enough to 1.59 Hz.

If you want more precise numbers, .measure is the way to go. Then you could use these commands (using the previous picture as reference, since I can't read the axes in your picture):

.meas t1 find time when v(x)=0 cross=2
.meas t2 find time when v(x)=0 cross=4
.meas t3 find time when v(x)=0 cross=6
.meas t4 find time when v(x)=0 cross=8
.meas f1 param 1/(t2-t1)
.meas f2 param 1/(t3-t2)
.meas f3 param 1/(t4-t3)

I started with cross=2 to avoid possible mis-readings due to the initial zero response (it looks like you, also, have something like that). To avoid re-running the simulation (sometimes they can take days and many GB of data), you can add those lines ina text file, save it in some meaningful name, then use the File > Execute .MEAS script (with the waveform window active). For this example, these are the readouts:

t1: time=1.31504 at 1.31504
t2: time=1.94466 at 1.94466
t3: time=2.57432 at 2.57432
t4: time=3.20397 at 3.20397
f1: 1/(t2-t1)=1.58826
f2: 1/(t3-t2)=1.58817
f3: 1/(t4-t3)=1.58817

which, again, given no special care has been taken (compression, timestep, numdgt), it's close to the real result. Note that using the .meas commands implies knowing beforehand how the waveform is and where to measure. That's why using an external script is a good choice.

Or you could concoct your own frequency detector, but that would imply burdening the matrix solver with yet another payload.

PS: You, too, have a nice dot

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thank you very much for this help ! Thanks for the dot :) And thanks for the tips about external script. I didn't know it ! It could be helpful one day ! \$\endgroup\$
    – Jess
    Commented Aug 3, 2020 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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