What is Phase Margin formula ? Here I have wavefor...
# sky130
a
What is Phase Margin formula ? Here I have waveform, with instructions I am getting Phase margin 55degree Is there any formula that I put in ngspice and get directly Phase margin.
s
I don't know if there is a direct instruction, however you can extract the phase margin with a
.meas
instruction, that is, the value of the phase when modulus of gain is equal to 1. see the ngspice manual for the
.meas
instruction.
l
Copy code
.control
	let av = db(vref1)
    let ph = cphase(v(ref1))*180/3.14
    meas ac gbw when av=0
	meas ac pm find ph at=gbw
.endc
🙌 2
🌍 1
a
yes it working