Context
According to LAB 3L.1.1 -- Response to a Sinusoid in Learning the Art of Electronics - a Hands-On Lab Guide (by Hayes, Thomas C. and Horowitz, Paul, Cambridge University Press, 2016) 3L.1 RC Resonant Circuit]] the best way to determine the resonance frequency with an oscilloscope in real-life is to look for when the output is in phase with the input, which is much easier to determine visually than trying to gauge the maximum signal amplitude.
Problem
In LTspice both measurements are very easy to carry out. I assumed I’d get the exact same results either way. However, measurements based on phase produce slightly different results than those based on peak amplitude. The difference is under 1%, which is negligible. There’s no difference when using ideal components.
Question
I wonder if this is just a numerical issue of some kind, or, does peak amplitude really occur at a frequency slightly away from where the phase is 0°?
Attachments
IMPORTANT NOTE: LTspice defaults to returning all measurement data in dB
. I use the definition of decibels to convert these results back to their linear equivalents. Don't be fooled by the dB
dimension added to measurements ending in _linear
. This problem is further explored here: LTspice Measurements - Google Groups Forum
Collated Measurement Results
Similar measurements have been colour-coded to aid comparison of similar quantities.
LTSpice Circuit
Q_Factor_Measurement.asc
Version 4
SHEET 1 1376 1620
WIRE -32 464 -64 464
WIRE 0 464 -32 464
WIRE 112 464 80 464
WIRE 176 464 112 464
WIRE 224 464 176 464
WIRE -32 496 -32 464
WIRE 112 496 112 464
WIRE 176 496 176 464
WIRE 112 592 112 560
WIRE 144 592 112 592
WIRE 176 592 176 576
WIRE 176 592 144 592
WIRE -32 608 -32 576
WIRE 144 608 144 592
WIRE -48 832 -48 800
WIRE -16 832 -48 832
WIRE 16 832 16 816
WIRE 16 832 -16 832
WIRE -16 848 -16 832
FLAG -32 608 0
FLAG -64 464 IN
IOPIN -64 464 In
FLAG 224 464 OUT
IOPIN 224 464 Out
FLAG 144 608 0
FLAG -16 848 0
SYMBOL cap 128 496 M0
SYMATTR InstName C1
SYMATTR Value 0.01µ
SYMBOL ind 160 480 R0
SYMATTR InstName L1
SYMATTR Value 10m
SYMBOL voltage -32 480 R0
WINDOW 3 -46 63 Right 1
WINDOW 123 -76 97 Left 2
WINDOW 39 -41 77 Right 2
WINDOW 0 -64 41 Left 2
SYMATTR Value SINE(0 {V} {freq})
SYMATTR Value2 AC 1
SYMATTR SpiceLine Rser={Rs}
SYMATTR InstName V1
SYMBOL res 96 448 R90
WINDOW 0 5 56 VBottom 2
WINDOW 3 5 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 100k
SYMATTR SpiceLine tol=1 pwr=0.1
SYMBOL cap -32 736 M0
SYMATTR InstName C2
SYMATTR Value 0.01µ
SYMATTR SpiceLine V=25 Irms=0 Rser=0.3555 Lser=490p mfg="Würth Elektronik" pn="885012208052 WCAP-CSGP 1206" type="X7R"
SYMBOL ind 0 720 R0
SYMATTR InstName L2
SYMATTR Value 10m
SYMATTR SpiceLine Ipk=0.1 Rser=29.9 Rpar=1.62e+006 Cpar=6.7p mfg="Würth Elektronik" pn="7445640 WE-PD4 Type L"
TEXT 424 648 Left 2 !.ac dec 100000 10k 20k
TEXT 424 624 Left 2 !.options nomarch
TEXT 424 456 Left 2 !.param V=1 Rs=50
TEXT -208 352 Left 5 ;Q-Factor Measurement
TEXT 424 480 Left 2 !.param freq = 50k
TEXT 424 552 Left 2 !.param period = {1/freq}
TEXT 424 432 Left 2 ;Inputs
TEXT 424 528 Left 2 ;Calculations
TEXT 424 600 Left 2 ;Simulation
TEXT -160 904 Left 2 ;Logging
TEXT -144 960 Left 2 !.meas AC f_peak_phase FIND V(OUT) WHEN ph(V(OUT))=0
TEXT -144 992 Left 2 !.meas AC v_peak_phase FIND mag(V(OUT)) WHEN ph(V(OUT))=0
TEXT -144 1032 Left 2 !.meas AC delta_f_phase trig mag(V(out))=v_peak_phase/sqrt(2) rise=1\n+ targ mag(v(out))=v_peak_phase/sqrt(2) fall=last
TEXT -144 1120 Left 2 !.meas AC Q_factor_phase_db PARAM center_freq_phase/delta_f_phase
TEXT -144 1144 Left 2 !.meas AC Q_factor_phase_linear PARAM pow(10, Q_factor_phase_db/20)
TEXT -144 1232 Left 2 !.meas AC v_peak_mag max mag(V(out))
TEXT -144 1264 Left 2 !.MEAS AC delta_f_mag trig mag(V(out))=v_peak_mag/sqrt(2) rise=1\n+ targ mag(V(out))=v_peak_mag/sqrt(2) fall=last
TEXT -144 1312 Left 2 !.measure AC center_freq_mag when mag(V(out))=v_peak_mag
TEXT -144 1080 Left 2 !.measure AC center_freq_phase when ph(V(out))=0
TEXT 144 704 Left 2 ;Ideal Components
TEXT -160 928 Left 2 ;Phase-based calculations
TEXT -160 1200 Left 2 ;Magnitude-based calculations
TEXT -144 1352 Left 2 !.meas AC Q_factor_mag_db PARAM center_freq_mag/delta_f_mag
TEXT -144 1376 Left 2 !.meas AC Q_factor_mag_linear PARAM pow(10, Q_factor_mag_db/20)
TEXT -144 1440 Left 2 !.meas AC calc_error PARAM pow(10, q_factor_phase_linear/(20*q_factor_mag_linear))
TEXT -144 1576 Left 2 !.meas AC 3db_low_from_angle FIND V(out) WHEN ph(V(OUT)) = 45
TEXT -96 704 Left 2 ;Real Components
TEXT 432 736 Left 2 !.step param pretty_print list 1 2
TEXT 432 712 Left 2 ;Trick
RECTANGLE Normal 96 880 -112 688 2
RECTANGLE Normal 336 880 128 688 2
Q_Factor_Measurement.plt
[AC Analysis]
{
Npanes: 1
{
traces: 1 {524290,0,"V(out)"}
X: ('K',0,10000,1000,20000)
Y[0]: (' ',0,0.00794328234724281,3,1)
Y[1]: (' ',0,-100,20,100)
Log: 0 2 0
GridStyle: 1
PltMag: 1
PltPhi: 1 0
}
}