
%generates a log spiral formatted in EZNEC wire coords, N3OX 3/30/16

A = 1;
b = 0.1;
Az = 0.85;
bz = 0.09;

NSEG_BASE = 1;
HEIGHT = 5; %height of first wire in meters;

theta = [0:pi/3:10*pi]; %pi/3 for a hex --- can be increased if you want to model a smoother spiral
%formula for log spiral --- assuming different dependence for z
r = A*exp(b*theta);
z = Az*exp(bz*theta)+HEIGHT;

x = r.*sin(theta);
y = r.*cos(theta);
%figure; plot3(x,y,z,'o-');
%axis equal
length = sqrt(diff(x).^2+diff(y).^2+diff(z).^2);
N = round(NSEG_BASE*length);
N(N==0) = 1;
M = [x(1:end-1)' y(1:end-1)' z(1:end-1)' x(2:end)' y(2:end)' z(2:end)' 0.001*ones(size(z(2:end)')) N'];
save('-ascii','coords.txt','M')
