Matlab Code

You might also like

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 5

%**************************************************************************

% Name: RadPattern3D

% Author: Arslan Shahid

% Date: March 15, 2010

% Description: 3-D Radiation Pattern of Dipole Antenna

% Reference Constantine A.Balanis, Antenna Theory Analysis And

% Design , 3rd Edition, page 173, eq. 4-64

%**************************************************************************

%Usage:

%This program plots 3-D radiation Pattern of a Dipole Antenna

%All the parameters are entered in the M-File

clear all

%Defining variables in spherical coordinates

theta=[0:0.12:2*pi];%theta vector

phi=[0:0.12:2*pi];%phi vector

l_lamda1=1/100;% length of antenna in terms of wavelengths

I0=1;% max current in antenna structure

n=120*pi;%eta
% evaluating radiation intensity(U)

U1=( n*( I0^2 )*( ( cos(l_lamda1*cos(theta-(pi/2))/2) - cos(l_lamda1/2) )./ sin(theta-(pi/2)) ).^2


)/(8*(pi)^2);

%converting to dB scale

U1_1=10*log10(U1);

%normalizing in order to make U vector positive

min1=min(U1_1);

U=U1_1-min1;

% expanding theta to span entire space

U(1,1)=0;

for n=1:length(phi)

theta(n,:)=theta(1,:);

end

% expanding phi to span entire space

phi=phi';

for m=1:length(phi)

phi(:,m)=phi(:,1);

end

% expanding U to span entire space

for k=1:length(U)

U(k,:)=U(1,:);
end

% converting to spherical coordinates

[x,y,z]=sph2cart(phi,theta,U);

%plotting routine

surf(x,y,z)

colormap(copper)

title('Radition Pattern for Dipole Antenna (length=1.5lamda)')

xlabel('x-axis--->')

ylabel('y-axis--->')

zlabel('z-axis--->')

below code Calculates the length and width and inset of microstrip patch antenna

clc

clear all

format long

% er=2.2;

% f=10e9;

% h=0.1588*10;

er=input('Enter the di-electric constant:');

h=input('Enter the substrate thickness (in mil)');

f=input('Enter the frequency (GHz):');


% er=3.5;

f=f*1e9;

h=h*0.0254; % in mm

wid=(3e8/(sqrt((er+1)/2)*2*f))*1000; %in mm

e_eff=((er+1)/2)+ (((er-1)/2)* (1+((12*h)/wid))^-0.5);

l_eff=(3e8/(2*f*sqrt(e_eff)))*1000;

del_l=(((e_eff+0.3)*((wid/h)+0.264))/((e_eff-0.258)*((wid/h)+0.8)))*(0.412*h); %in mm

L=l_eff-(2*del_l);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

la=(3e8/f)*1000;

k=(2*pi)/la;

x=k*(wid);

i1=-2+cos(x)+(x*sinint(x))+(sin(x)/x);

g1=i1/(120*pi*pi); %Conductance

% jb=besselj(0,(k.*L.*sin(th)));
a=@(th)(((sin((x./2).*cos(th))./cos(th)).^2).*(besselj(0,(k.*L.*sin(th)))).*(sin(th)).^3);

a1=quad(a,0,pi);

g12=a1/(120*pi*pi); %in siemens

r_in=1/(2*(g1+g12)); %in ohms

inset=(L/pi)*(acos(sqrt(50/r_in))); %in mm

disp(['The width is:',num2str(wid),' mm'])

disp(['The length is:',num2str(L),' mm'])

disp(['The inset feed point is:',num2str(inset),' mm'])

You might also like