APPENDIX
clc; % Clear screen
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat % Read data in the input
file
g=5;
for i=1:g,
N = DATAS(i,1);% Prompt for number of elements in an array.
SLL = DATAS(3,2);% Prompt for the required Side Lobe
Level.
R = 10.^(SLL/20); % Convert to ratio
Zo = cosh((1/(N-1))*acosh(R)); % Determine Zo
spacing = DATAS(3,3);% Prompt for the Normalised
Inter-element Spacing.
t = 0:1:179;
theta = t*pi/180; % Convert to radian
u = pi*spacing*cos(theta);
if N == 2;
AFp = [1]; % Polynomial of excitation coefficient
AFc = [1*Zo]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(1,1); % Normalized with respect to the amplitude of
the elements at the edge
AF = abs(Xo(1,1)*cos(u)); % Determine the array factor
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
title('RADIATION PATTERN WITH 2 ELEMENTS');
xlabel('Thetal');
ylabel('Array Factor')
grid; % Turn grid on
pause
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat % Read data in the input
file
elseif N == 3;
AFp = [0,2;
1,-1]; % Polynomial of excitation coefficient
AFc = [2*Zo^2; % Chebyshev polynomial
-1];
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(2,1); % Normalized with respect to the amplitude of
the elements at the edge
AF = abs(Xo(1,1)+Xo(2,1)*cos(2*u));% Determine the array
factor
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
grid % Turn grid on
pause
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat % Read data in the input
file
elseif N==4;
AFp = [0,4;
1,-3]; % Polynomial of excitation coefficient
AFc = [4*Zo^3;
-3*Zo]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(2,1); % Normalized with respect to the amplitude of
the elements at the edge
AF = abs(Xo(1,1)*cos(u)+Xo(2,1)*cos(3*u));% Determine the
array factor
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
title('RADIATION PATTERN WITH 4 ELEMENTS');
xlabel('Thetal');
ylabel('Array Factor')
grid % Turn grid on
pause
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat % Read data in the input
file
elseif N == 5;
AFp = [0,0,8;
0,2,-8;
1,-1,1]; % Polynomial of excitation coefficient
AFc = [8*Zo^4;
-8*Zo^2;
1]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(3,1); % Normalized with respect to the amplitude of
the elements at the edge
AF = abs(Xo(1,1)+Xo(2,1)*cos(2*u)+Xo(3,1)*cos(4*u));%
Determine the array factor
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
grid % Turn grid on
pause
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat % Read data in the input
file
elseif N==6;
AFp = [0,0,16;
0,4,-20;
1,-3,5,]; % Polynomial of excitation coefficient
AFc = [16*Zo^5;
-20*Zo^3;
5*Zo]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(3,1); % Normalized with respect to the amplitude of
the elements at the edge
AF = abs(Xo(1,1)*cos(u)+Xo(2,1)*cos(3*u)+Xo(3,1)*cos(5*u));%
Determine the array factor
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
title('RADIATION PATTERN WITH 6 ELEMENTS');
xlabel('Thetal');
ylabel('Array Factor')
grid % Turn grid on
pause
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat % Read data in the input
file
elseif N == 7;
AFp = [0,0,0,32;
0,0,8,-48;
0,2,-8,18
1,-1,1,-1]; % Polynomial of excitation coefficient
AFc = [32*Zo^6;
-48*Zo^4;
18*Zo^2;
-1]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(4,1); % Normalized with respect to the amplitude of
the elements at the edge
AF
=abs(Xo(1,1)+Xo(2,1)*cos(2*u)+Xo(3,1)*cos(4*u)+Xo(4,1)*cos(6*u));% Determine
the array factor
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); %Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
grid % Turn grid on
pause
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat % Read data in the input
file
elseif N==8;
AFp = [0,0,0,64;
0,0,16,-112;
0,4,-20,56;
1,-3,5,-7,]; % Polynomial of excitation coefficient
AFc = [64*Zo^7;
-112*Zo^5;
56*Zo^3;
-7*Zo]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(4,1); % Normalized with respect to the amplitude of
the elements at the edge
AF
=abs(Xo(1,1)*cos(u)+Xo(2,1)*cos(3*u)+Xo(3,1)*cos(5*u)+Xo(4,1)*cos(7*u));%
Determine the array factor
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
grid % Turn grid on
title('RADIATION PATTERN USING 8 ELEMENTS');
xlabel('Thetal');
ylabel('Array Factor')
mytable=fopen('RESULTS.txt','wt'); %open ouput file for
writing
fprintf(mytable, 'THETAL\tARRAY FACTOR\n');
A=[theta1];
B=[AF2];
for p=0:1:179
for q=p,
fprintf(mytable, '%.2f\t %.2f\n', A(p), B(q));
fclose (mytable);
end
end
pause
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat
elseif N == 9;
AFp = [0,0,0,0,128;
0,0,0,32,-256;
0,0,8,-48,160;
0,2,-8,18,-32;
1,-1,1,-1,1]; % Polynomial of excitation coefficient
AFc = [128*Zo^8;
-256*Zo^6;
160*Zo^4;
-32*Zo^2;
1]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(5,1); % Normalized with respect to the amplitude of
the elements at the edge
AF
=abs(Xo(1,1)+Xo(2,1)*cos(2*u)+Xo(3,1)*cos(4*u)+Xo(4,1)*cos(6*u)+Xo(5,1)*cos(8*u));
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
grid % Turn grid on
pause
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat
elseif N==10;
AFp = [0,0,0,0,256;
0,0,0,64,-576;
0,0,16,-112,432;
0,4,-20,56,-120;
1,-3,5,-7,9]; % Polynomial of excitation coefficient
AFc = [256*Zo^9;
-576*Zo^7;
432*Zo^5;
-120*Zo^3;
9*Zo]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(5,1); % Normalized with respect to the amplitude of
the elements at the edge
AF
=abs(Xo(1,1)*cos(u)+Xo(2,1)*cos(3*u)+Xo(3,1)*cos(5*u)+Xo(4,1)*cos(7*u)+Xo(5,1)*cos(9*u));
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of thearray factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
grid % Turn grid on
title('RADIATION PATTERN WITH 10 ELEMENTS');
xlabel('Thetal');
ylabel('Array Factor')
end
end
pause
clc; % Clear screen
clear; % Clear all variables
% Prompt for number of elements in an array.
load C:\MATLAB6p5p1\work\DATAS.dat
% Prompt for the required Side Lobe Level.
h=5;
for j=1:h,
SLL = DATAS(j,2);
R = 10.^(SLL/20); % Convert to ratio
N = DATAS(4,1);
Zo = cosh((1/(N-1))*acosh(R)); % Determine Zo
spacing = DATAS(3,3);% Prompt for the Normalised
Inter-element Spacing.
t = 0:1:179;
theta = t*pi/180; % Convert to radian
u = pi*spacing*cos(theta);
if N==8;
AFp = [0,0,0,64;
0,0,16,-112;
0,4,-20,56;
1,-3,5,-7,]; % Polynomial of excitation coefficient
AFc = [64*Zo^7;
-112*Zo^5;
56*Zo^3;
-7*Zo]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(4,1); % Normalized with respect to the amplitude of
the elements at the edge
AF
=abs(Xo(1,1)*cos(u)+Xo(2,1)*cos(3*u)+Xo(3,1)*cos(5*u)+Xo(4,1)*cos(7*u));%
Determine the array factor
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
grid % Turn grid on
title('RADIATION PATTERN WITH VARIATION OF SLL');
xlabel('Thetal');
ylabel('Array Factor')
pause
clear; % Clear all variables
% Prompt for number of elements in an array.
load C:\MATLAB6p5p1\work\DATAS.dat
end
end
clc; % Clear screen
clear; % Clear all variables
load C:\MATLAB6p5p1\work\DATAS.dat
SLL = DATAS(3,2);% Prompt for the required Side Lobe
Level.
R = 10.^(SLL/20); % Convert to ratio
N = DATAS(4,1);
Zo = cosh((1/(N-1))*acosh(R)); % Determine Zo
m=5;
for u=1:m,
load C:\MATLAB6p5p1\work\DATAS.dat
spacing = DATAS(u,3);% Prompt for the Normalised
Inter-element Spacing.
t = 0:1:179;
theta = t*pi/180; % Convert to radian
u = pi*spacing*cos(theta);
N = DATAS(4,1);
if N==8;
AFp = [0,0,0,64;
0,0,16,-112;
0,4,-20,56;
1,-3,5,-7,]; % Polynomial of excitation coefficient
SLL = DATAS(3,2);
R = 10.^(SLL/20); % Convert to ratio
Zo = cosh((1/(N-1))*acosh(R)); % Determine Zo
AFc = [64*Zo^7;
-112*Zo^5;
56*Zo^3;
-7*Zo]; % Chebyshev polynomial
X = AFp\AFc; % Determine the excitation coefficient
Xo = X/X(4,1); % Normalized with respect to the amplitude of
the elements at the edge
AF
=abs(Xo(1,1)*cos(u)+Xo(2,1)*cos(3*u)+Xo(3,1)*cos(5*u)+Xo(4,1)*cos(7*u));
subplot(2,2,1);
polar(theta,AF); % Generate polar plot
AF1=20*log10(AF); % Convert to decibels
max=max(AF1); % Setting maximum value of the array factor to
"max"
AF2=AF1-max; % Set values of array factor with respect to
maximum value
theta1=(180/pi)*theta;
subplot(2,2,2);
plot(theta1,AF2); % Generate linear plot
axis([0 180 -40 0]); % Set maximum and minimum values for X
and Y scales
grid % Turn grid on
title('RADIATION PATTERN WITH VARIATION OF INTER ELEMENTS
SPACING');
xlabel('Thetal');
ylabel('Array Factor')
pause
clear; % Clear all variables
end
end
|