
%Set up input parameters
global EPS_0 C_LIGHT;
C_LIGHT = 2.99792458e8;      %Speed of light (m/s)
EPS_0 = 8.854187817e-12;     %Permittivity of free space (F/m)
eps = 75 * pi / 180;
kx = 1;
ky = 3;
lambda_u = .030;
gamma = 12000;
lambda_r = lambda_u * (1 / (2 * gamma^2)) * (1 + (1/2) * (kx^2 + ky^2));
z = -.25 : 200e-6 : 30 * lambda_u + .25;
x = 1 * ones(1, length(z));
y = 2 * ones(1, length(z));
vz0 = C_LIGHT * (1 - lambda_r / lambda_u);
ku = 2 * pi / lambda_u;
vx = vz0 * (kx / gamma) * cos(ku * z);
vy = vz0 * (ky / gamma) * cos(ku * z + eps);
vz = vz0 * ones(1, length(z));
%vz = C_LIGHT * (1 - (1/2) * ((1/gamma^2) + vx.^2/C_LIGHT^2 + vy.^2/C_LIGHT^2));
nx = 0;
ny = 0;
nz = 1;
omega_fund = C_LIGHT * 2 * pi / lambda_r;
% 
% %Change quantities
% %omega_fund = omega_fund * (1 + .01);
% index_array = (z < 0) | (z > 30 * lambda_u);
% vx(index_array) = 0;
% vy(index_array) = 0;

%Calculate the Fourier transform
[ft_er] = rad_calc_ft_er(x, y, z, vx, vy, vz, nx, ny, nz, omega_fund);
ft_er_und = ft_er(:, end);
ex_fund = ft_er_und(1);
ey_fund = ft_er_und(2);
ex_mag_fund = abs(ex_fund);
ey_mag_fund = abs(ey_fund);
exy_ang_fund = angle(ey_fund * conj(ex_fund));

%Display the results
disp('   ');
disp('rad_test_ft_er');
vyx_ratio = max(vy) / max(vx)
eyx_ratio = ey_mag_fund / ex_mag_fund
exy_ang_fund_deg = exy_ang_fund * 180 / pi
