% Jake Bobowski
% March 11, 2017
% Created using MATLAB R2014a

clearvars

% In this script I will attempt to calculate the response of a two-loop,
% one-gap LGR with one of the loops loaded with a SRR having negative
% relative permeability.  In these calculations, I'll assume that the two
% loops of the LGR are identical such that L1 = L2 = 2L.

% Enter the SRR dimensions, follow the example presented in Pendry's 1999 IEEE MTT paper.
r = 2e-3;
a = 5e-3;
d = 0.1e-3;

% Next, calculate the plasma frequency wp and resonance frequency ws of the
% SRR's permeability.
c0 = 3e8;
ws = sqrt(3*d*c0^2/(pi^2*r^3));
fs = ws/(2*pi)
wp = ws/sqrt(1-pi*r^2/a^2);
fp = wp/(2*pi)
sigma = 2;
mu0 = 4e-7*pi;
g = 2*sigma/(r*mu0);
gs = g/(2*pi)

% Now enter the expressions for mu1 (real part) and mu2 (imaginary part) and generate the appropriate plots.
f = linspace(0, 2*fp, 5000); % bunch of frequency values
mu1 = 1+(1-(ws/wp)^2)*((ws./(2*pi*f)).^2-1)./(((ws./(2*pi*f)).^2-1).^2.+(g./(2*pi*f)).^2);
plot(f,mu1,'r');
hold on;

mu2 = (g./(2*pi*f)).*(1-(ws/wp)^2)./(((ws./(2*pi*f)).^2-1).^2.+(g./(2*pi*f)).^2)
plot(f,mu2,'b');
hold off;
