Measuring Frequency

I’m creating a voltage controlled oscillator, which produces a square wave output. I’m setting up a .step sweep to plot voltage vs. frequency. However, I can’t figure out a way to have Qspice plot the frequency? I see there is a “Freq” function for the waveform view, but it’s not clear to me how that works.
I attempted to write the following expression in the waveform viewer: freq(v(q)); v(q) is my square wave, but this resulted in a syntax error.


These are for .ac analysis. For .tran, you have to use .meas to calculate frequency of time domain signal.

Can you upload your schematic?

this is for a .trans analysis.
I found the below example in your reference guide. This is exactly what I’m trying to do.
But I can’t figure out how to output the results of the .meas statement.

You can take a look of my Command Guide, .meas section of how to setup .meas for this type of measurement. Or do you able to upload your .qsch to forum?

Voltage Controlled Tri-Wave Generator.qsch (19.6 KB)
@KSKelvin I’m looking at your Command Guide now, .qsch uploaded

Your setup is correct, but you have to plot the .meas result. Qspice run your netlist with QSPICE64.exe or QSPICE80.exe, therefore, your first waveform window is to plot result from that, which is the file .qraw. .meas is a post-processing using QPOST.exe for .qraw datafile, its result return in Post Process window, or if you include .meas plot, it will create a file named as .meas.qraw for .meas result.

I modify your schematic by including .meas plot statement, and add TTOL to logic to improve timing precision.

To plot .meas result, you can also refer to my Command Guide, .meas section, page title “Plot .meas data in Waveform Viewer”. There are two method to do that.

Voltage Controlled Tri-Wave Generator (.meas plot).qsch (19.9 KB)

Thank you!
Shouldn’t this be “fall”?


Neverminded, it should be the time between two rising edges.

1 Like

To measure the period, the waveform needs to repeat itself. In this particular case, the .meas statement is used to measure the time between the 5th rising edge through V(Q)=0.5 and the 6th rising edge through V(Q)=0.5. Therefore, this measurement is actually determining the frequency.