# The script sets up the bias voltage and fruency sweep # and calculates the output impedance of the MOSFET load('nmos_ac.ldev'); switchtolayout; setnamed('CHARGE','log start frequency',1e6); setnamed('CHARGE','log stop frequency',2e10); setnamed('CHARGE','num frequency points per dec',3); select("CHARGE::boundary conditions::gate"); set('bc mode','steady state'); set('sweep type','single'); set('voltage',2); set('apply ac small signal','none'); select("CHARGE::boundary conditions::drain"); set('bc mode','steady state'); set('sweep type','range'); set('range start',0); set('range stop',5); set('range interval',0.25); set('apply ac small signal','last'); run; ac_data = getresult('CHARGE','ac_drain'); Iac = pinch(ac_data.dI); f = ac_data.f; Vac = ac_data.dV_drain; Zout = Vac/Iac; Yout = 1/Zout; plot(f*1e-9,abs(Zout),'Freq (GHz)','|Zout| (Ohm)','','log10x,log10y'); plot(f*1e-9,angle(Zout)*180/pi,'Freq (GHz)','angle[Zout] (degree)','','log10x'); matlabsave('nmos_Zout',f,Zout);