
% The parameters of the oscillator circuit

%Step 1 Run S_parameters to generate the S-parameters for
% the transistor.

clear all
S_parameters_BF199

det = (1 + S11).*(1 + S22) - S21.*S12;

%Step 2 calculate the y-parameters
yi = ((1 + S22).*(1 - S11) + S12.*S21)./det/Z0;
yr = -2*S12./det/Z0;
yf = -2*S21./det/Z0;
yo = ((1 + S11).*(1 - S22) + S12.*S21)./det/Z0;

N = 6;           %number of nodes
y = zeros(N,N,Nvals); %The admittances
omega = 2*pi*frequency;















CT = 2e-12;
LT = 8000.e-9;
CLT = .1e-12;

ZCLT = 1./j./omega/CLT;
ZLT = 1.+j*omega*LT;
ZT = (ZCLT.*ZLT)./(ZCLT + ZLT) + 1./j./omega/CT;
YT = 1./ZT;

C1 = 10.0e-12;
Z1 = 1/j./omega/C1;

C2 = 20.0e-12;
Z2 = 1/j./omega/C2;

R1 = 43.;
R2 = 3300.;
RL = 50.;








y(1,2,:) = YT;
y(2,1,:) = YT;
y(3,2,:) = 1./Z1;
y(2,3,:) = 1./Z1;
y(4,2,:) = yi+yr;
y(5,2,:) = -yr;

y(2,3,:) = 1./Z1;
y(3,2,:) = 1./Z1;
y(4,3,:) = 1/R1;
y(3,4,:) = 1/R1;
y(6,3,:) = 1/R2 + 1./Z2;
y(3,6,:) = 1/R2 + 1./Z2;

y(2,4,:) = yi+yf;
y(5,4,:) = yr+yo;
y(3,4,:) = 1/R1;
y(4,3,:) = 1/R1;

y(2,5,:) = -yf;
y(4,5,:) = yf+yo;
y(6,5,:) = 1/RL;
y(5,6,:) = 1/RL;


