I want to find fundamental frequency of a periodic signal (non-sinusoidal) in certain time window using the .meas
command in LTSpice.
I was using the following code to calculate frequency (in kHz).
.meas tran T1 find time when V(OUT)=0 rise 1000
.meas tran T2 find time when V(OUT)=0 rise 1100
.meas tran Frequency param 100/(1000*(T2-T1))
This works fine for certain cases, but when I do the parametric sweep, it gives inaccurate readings because of two issues:
Here, I assume at 1000th cycle, signal reaches its measurement window (say from time=4ms) but sometimes it doesn't. Therefor, I want to specify the absolute time for the measurement. from 4ms in this case, I have added a sample voltage waveform as below (with parametric sweep)
The zoomed waveform from 4ms is
My questions is
Is it possible to specify the starting time for the above code so that it will count cycles from the specified time? ( I tried to use trig
-trag
and from
-to
commands but failed)
.four
when the fundamental frequency is unknown? Primary goal here to measure the fundamental frequency in a specified time window \$\endgroup\$.meas
). The only thing I see is to run your simulation and thenView > FFT
, and then decide which one is your fundamental, but this is not an automated process. You say you have a parametric sweep. Can't your harmonics, or anything that you can cling to, be related to the swept parameters? Some correlation? \$\endgroup\$