### Calculates g and C_diff from small signal simulation ### ###### in forward bias as a function of frequency ###### contact = 'emitter'; ac_data = getresult('CHARGE','ac_'+contact); dI = pinch(getdata('CHARGE','ac_'+contact,'dI')); dV = pinch(getdata('CHARGE','ac_'+contact,'dV_'+contact)); f = pinch(getdata('CHARGE','ac_'+contact,'f')); w = 2*pi*f; Vbias = pinch(getdata('CHARGE','ac_'+contact,'V_'+contact)); # get the length of voltage and frequency sweeps kern = size(dI); nV = kern(1); nf = kern(2); Gcomp = dI/dV; Gcomp = Gcomp(nV,1:nf); G = real(Gcomp); C = imag(Gcomp)/w; # normalize conductance and capaciatnce with LF values G_norm = G/G(1); C_norm = C/C(1); plot(f,G_norm,C_norm,'Freq (Hz)','Gdiff/Gdiff_0, Cdiff/Cdiff_0','','log10x,log10y'); legend('g_forward','C_forward');