%%load the relevant circuit parameters
close all
clear all
set(0,'DefaultLineLineWidth',3)
set(0,'DefaultAxesFontSize',20)
set(0,'DefaultTextFontSize',20)

LOPASS;

m = zeros(N-1,N-1,Nvals);
Current_Source = [1,zeros(1,N-2)]';
%'
mm = sum(y,1);

for ii = 1:N-1

      m(ii,ii,:) = mm(1,ii,:);

      for jj = 1:N-1
            if  ii ~= jj 
                 m(ii,jj,:) = -y(jj,ii,:);
            end
      end
end

Volts = zeros(N-1,Nvals);
for ii = 1:Nvals
       Volts(:,ii) = inv(m(:,:,ii))*Current_Source;
end

TF = 2/Zo*Volts(4,:);
TF = 20*log10(abs(TF));

figure(1)
semilogx(frequency,TF);
xlabel('Frequency (MHz)')
ylabel('dB')
axis([10e6 1000e6 -100 10])
title('transfer function')

Zin = Volts(1,:)*Zo./ ( Zo - Volts(1,:) );

figure(2)
semilogx(frequency,real(Zin));
hold on
plot(frequency,imag(Zin));
hold off
xlabel('Frequency (MHz)')
ylabel('Ohms')
axis([10e6 1000e6 -200 200])
title('Input Impedance')
