%% Pattern for Directional Transmitter and Receiver
% Create directional antenna.

yagiAntenna = design(yagiUda,4.5e9);
yagiAntenna.Tilt = 90;
yagiAntenna.TiltAxis = 'y';

%
% Create transmitter and receiver sites at a frequency of 4.5 GHz. Use the Yagi antenna as the transmitter antenna. Design a dipole at 4.5 GHz and use this as the receiver antenna.

fq = 4.5e9;
tx = txsite('Name','MathWorks','Latitude',42.3001,'Longitude', -71.3503, ...
      'Antenna', yagiAntenna,'AntennaAngle', 90,'AntennaHeight', 30, ...
      'TransmitterFrequency', fq,'TransmitterPower', 10);
rx = rxsite('Antenna',design(dipole, fq));
 

%
% Position the receiver 200 meters from the transmitter.

 [lat,lon] = location(tx,200,90);
 rx.Latitude = lat;
 rx.Longitude = lon;

%
% Display both transmitter and receiver patterns.

pattern(tx,'Transparency',0.2);
pattern(rx, fq);

%
% Copyright 2018 The MathWorks, Inc.