function s = yagi7(pos,dir,c)
% s = yagi7(pos,dir,c)
% 7-element-Yagi like FX213
% pos :  [x y z]-vector of center of mass position of the antenna (default [0 0 0])
% dir :  main radiation direction: Euler's angles or transformation matrix.
%        See function rotation for details. (default: positive x direction)
% c   :  complex amplitude of excitation (default 1.0)

% Author:  Klaus von der Heide, e-mail:  dj5hg@qsl.net

% Default
% =======
if nargin<3, c = 1; end

% Constants
% =========
k = 2;                   % index of active dipole
d = 0.002;               % diameter of passive elements
dd= 0.008;               % diameter of active dipole
x = [-0.39;  0;     0.165; 0.54;  1.08;  1.65;  2.34] - 0.90; % element positions
l = [ 0.5175;0.5000;0.4775;0.4725;0.4700;0.4675;0.4550];      % half length of elements
n = length(x);           % number of elements
z = zeros(n,1);          % height of antenna elements
m = 15;                  % number of segments per element

% Construction
% ============
a  = [x -l z];           % coordinates of one end of elements
b  = [x +l z];           % coordinates of the other end of elements
el = wires(a([1,3:end],:),b([1,3:end],:),d,m);             % passive elements
dp = exwire(a(k,:),b(k,:),dd,m,c);                         % dipole
boom = wire([x(1)-0.03 0 0-0.02], [x(end)+0.03 0 0-0.02], 0.02, 20); % Boom
s = construct(dp,el,boom);  % putting all together

% Possible shift and rotation
% ===========================
if nargin>0,  s = translation(s,pos); end
if nargin>1,  s = rotation(s,dir);    end
