clear; load('moscap.ldev'); switchtolayout; dV = 0.025; V = matrix(22,1); V(1:2:22) = linspace(0,2.5,11); V(2:2:22) = V(1:2:22)+dV; select("CHARGE::boundary conditions::gate"); set('bc mode','steady state'); set('sweep type','value'); set('value table',V); set('apply ac small signal','none'); setnamed("CHARGE","solver mode","steady state"); setnamed("CHARGE::mesh","max edge length",1e-9); run; netQ = getresult("CHARGE::monitor","net_charge"); Wx = getnamed('CHARGE simulation region','x span'); Qall = pinch(netQ.Q); dQ = Qall(2:2:22)-Qall(1:2:22); C_pos = dQ/dV/Wx*1e-4; ### switchtolayout; V(1:2:22) = linspace(0,-2.5,11); V(2:2:22) = V(1:2:22)-dV; select("CHARGE::boundary conditions::gate"); set('bc mode','steady state'); set('sweep type','value'); set('value table',V); #set('apply ac small signal','all'); run; netQ = getresult("CHARGE::monitor","net_charge"); Qall = pinch(netQ.Q); dQ = Qall(2:2:22)-Qall(1:2:22); C_neg = -dQ/dV/Wx*1e-4; C_static = [flip(C_neg,1);C_pos(2:11)]; # F/cm^2 Vdc = linspace(-2.5,2.5,21); plot(Vdc,C_static*1e9); matlabsave('moscap_static_Cap',Vdc,C_static);