%modelling the autotransformer helical resonator
clear all
close all
Zo = 50;
fc = 50.e6;
omc = 2*pi*fc;

LT = 1e-7
Q = 100;

nu = sqrt(Zo/omc/LT/Q)

%Pick a coupling cap
Cc = 5e-12
Cc = .2e-12
Cc = .2e-12

LT = Zo/Q/nu/nu/omc
CT = 1/LT/omc/omc

%The auto TF...
L1 = nu*nu*LT;
M = nu*LT;
L2 = LT;

%Nvals... the number of frequency points
Nvals = 1000;

%Specify the number of nodes
N = 7;

%initialise all ys
y = zeros(N-1,N,Nvals);
frequency = linspace(40e6,60e6,Nvals);
omega = 2*pi*frequency;

%Define the frequncies around the resonant frequency

Ycc  = j*omega*Cc;
YCT = j*omega*CT;

y(1,7,:) = 1/Zo;
y(7,1,:) = y(1,7,:);

y(1,2,:) = 1/j./omega/(L1 - M);
y(2,1,:) = 1/j./omega/(L1 - M);

y(2,7,:) = 1/j./omega/M;
y(7,2,:) = 1/j./omega/M;

y(2,3,:) = 1/j./omega/(L2 - M);
y(3,2,:) = 1/j./omega/(L2 - M);

y(7,3,:) = YCT;
y(3,7,:) = YCT;

y(3,4,:) = Ycc;
y(4,3,:) = Ycc;

y(7,4,:) = YCT;
y(4,7,:) = YCT;

y(4,5,:) = 1/j./omega/(L2 - M);
y(5,4,:) = 1/j./omega/(L2 - M);

y(5,7,:) = 1/j./omega/M;
y(7,5,:) = 1/j./omega/M;

y(5,6,:) = 1/j./omega/(L1 - M);
y(6,5,:) = 1/j./omega/(L1 - M);

y(6,7,:) = 1/Zo;
y(7,6,:) = y(1,7,:);

