%% Design and Analyze Cassegrain Antenna
% This example shows how to create a cassegrain antenna.
% A typical parabolic antenna consists of a parabolic reflector with a small
% feed antenna at its focus. Parabolic reflectors used in dish antennas have 
% a large curvature and short focal length and the focal point is located near the
% mouth of the dish, to reduce the length of the supports required to hold 
% the feed structure. In more complex designs, such as the cassegrain antenna,
% a sub reflector is used to direct the energy into the parabolic reflector 
% from a feed antenna located away from the primary focal point. Cassegrain
% provides an option to increase focal length, reducing side lobes. Such type
% of antennas can be used in satellite communications as well as Astronomy 
% and other emerging modes of communications.

%   Copyright 2019 The MathWorks, Inc.

%% Define Parameters
% Parameters given below helps designing of  the cassegrain antenna 
%%
% Rp = Diameter of main reflector
%% 
% fp = Focal Length of main reflector
%%
% Rsub = sub reflector diameter
%%
% fhyp = focal length of hyperbola
Rp=0.3175;
fp=0.2536;
Rsub=0.033;
fhyp=0.1416;
%% Model Cassegrain Antenna
% Cassegrain antenna typically has three structures. First is the main
% reflector which is parabolic, second is the subreflector which is
% hyperbolic, third is the exciter element. Focus of the main reflector and
% the near focus of the hyperbolic subreflector coincides. The energy
% is directed from the subreflector towards main reflector. The
% parabolic reflector converts a spherical wavefront into a plane wavefront
% as the energy directed towards it appears to be coming from focus.
ant=cassegrain('Radius',[Rp Rsub],'FocalLength',[fp fhyp]);
show(ant);
%% Define Exciter Element
% Conical horn is used as the default exciter for cassegrain. It is oriented
% towards the sub reflector. It is designed at a frequency which gives the
% desired performance. The aperture diameter is chosen analytically to give
% the desired co-planar pattern beam width.
Exciter=design(hornConical,17.7e9);
Exciter.FeedWidth=3.4e-3;
Exciter.Tilt=270;
Exciter.TiltAxis=[0 1 0]; 
show(Exciter);
%% Solve Structure
% Default cassegrain antenna uses PO solver for main reflector and MoM solver 
% for sub reflector and exciter. Diameter of main reflector is 39 $${\lambda}$
% and that of sub reflector is 4 $${\lambda}$. Solvers are used according to the size of
% main reflector and subreflector. Typically, if  the diameter sub reflector
% is greater than 5 $${\lambda}$, then it is recommended to use PO solver for it. 
% Normally the expected diameter of subreflector  is to be less than 
% 20% of main reflector to minimize the blockage by the subreflector.

%% Plot Radiation Pattern and Mesh Antenna
% Plot the radiation pattern of cassegrain antenna at 18GHz.The expected 
% pattern need to generate a pencil like beam with less spill over and minor
% lobe radiation. Default Cassegrain antenna generates more number of
% triangles, so it can  be meshed manually for different mesh edge lengths for the required 
% numbers of triangular generation. This solves the structure quickly, but
% the gain decreases compared to default in such cases. Mesh can be
% controlled for exciters and reflectors separately with different mesh edge
% lengths.
ant=cassegrain;
ant.Exciter=design(hornConical,17.7e9);
ant.Exciter.Tilt=270;
[~]=mesh(ant,'MaxEdgeLength',15e-3);
figure;
pattern(ant,18e9);
%%
% Comparing with parabolic reflector which does not have subreflector shows that
% cassegrain configuration increases directivity.
ant=reflectorParabolic('Radius',0.3175);
ant.Exciter=design(hornConical,17.7e9);
ant.Exciter.Tilt=90;
figure;
pattern(ant,18e9);
%% S-parameters and Impedance Plot
% Plot the s-parameters and impedance of cassegrain antenna over a frequency range of
% 18 GHz to 18.8 GHz. It provides a bandwidth of about 100MHz and the
% structure resonates at 18.51 GHz.
ant=cassegrain;
s=sparameters(ant,linspace(18e9,18.8e9,25));
figure;rfplot(s);
%% 
figure;
impedance(ant,linspace(18e9,18.8e9,25));
%% Current Distribution
% Analyze the current distribution of cassegrain at a specified frequency.
current(ant,18e9,'scale','log10');
%% Use Different Exciters with Tilts
% Several other elements are supported as exciters like horn, waveguides
% and so on. Exciter can be tilted in the required direction based on the
% need.
Exciter=design(horn,16.2e9);
Exciter.Tilt=270;
Exciter.TiltAxis=[0 1 0]; 
ant.Exciter=Exciter;
show(ant);
figure;
pattern(ant,18e9);
%% Conclusion
% Using the Cassegrain design increases antenna performance as the feed
% antenna is directed forward rather than towards a dish in front fed
% antenna. This orientation reduces side lobes and the use of dual reflectors 
% helps in tailoring radiation pattern for maximum antenna performance.
%% References
% Dandu, Obulesu. "Optimized Design of Axially Symmetric 
% Cassegrain Reflector antenna using Iterative Local Search Algorithm." (2013).
