Вы находитесь на странице: 1из 5

clc;

clear;
close all;
format long;
warning off;
%---Definition of constants and initialization---
PI = 4.0*atan(1.0); % pi
E = 120.0*PI; % eta ie intrinsic impedance
THETA = PI/180.0; % theta max value
UMAX = 0.0; % maximum radiation intensity
PRAD = 0.0; % power radiated
TOL = 1.0E-6; % tolerance
f1=57e9; % start frequency
f2=64e9; % stop frequency
freq=f1:0.1e9:f2; % frequency range
c=3e8; % speed of light
n=120*pi; % intrinsic impedance
k=2*pi; % 2 * pi
gain=zeros(length(freq),1);% initializing gain array for storing results for sweep
response
S11=zeros(length(freq),1); % initliatizing S11 array for storing results for sweep
response
for i=1:length(freq)
lamda=c/freq(i); % wavelength
L=lamda/4; % quarter wavelength monopole antenna element
r=0.2*L; % radius of monopole antenna element
A = L*PI*134; % Maximum Effective apperture area of monopole antenna element
I = 1;
while(I <= 180) % Evaluating for each theta value
XI = I*PI/180.0; % Instantaneous theta value
if(XI ~= PI)
U = ((cos(A*cos(XI))-cos(A))/sin(XI))^2*(E/(8.0*PI^2)); % Instantaneous value of
Radiation intensity
if(U > UMAX)
UMAX = U; % Maximum radiation intensity

end
end
UA = U*sin(XI)*THETA*2.0*PI; % Radiation intensity a factor of theta
I = I+1;
end
end
%---Calculation of elevation far-field patterns in 1 degree increments---
T = zeros(180,1);
ET = zeros(180,1);
EdB = zeros(180,1);
x = 1;
while(x<=180)
T(x) = x-0.99;
ET(x) = (cos(PI*L*cos(T(x)*THETA))-cos(PI*L))/sin(T(x)*THETA); % Intensity in theta
direction
x = x+1;
end
ET = abs(ET); % absolute value
ETmax = max(abs(ET)); % maximum intensity
EdB = 20*log10(abs(ET)/ETmax); % gain in dbs
T=T'; EdB=EdB';
EdB=[EdB fliplr(EdB)];
% expanding U to span entire space
EdB=EdB';
U=zeros(360,180);
for k=1:180
U(:,k)=EdB(:,1); % gain in phi orientation
end
az=-180:1:180; % azimuth coverage
el=-90:1:90; % elevation coverage
fmax=60e9;
freqvector=[59 60].*1e9; % frequency vector
UV=[U U EdB];
UU=UV(1:181,1:361); % gain in 3D space

sAnt=phased.CustomAntennaElement('FrequencyVector',freqvector,'AzimuthAngles',az,'E
leva-tion Angles',el,'RadiationPattern',UU);
sArray= phased.ULA('Element',sAnt,'NumElements',4,'ElementSpacing',0.5* lamda);
sArray = phased.URA('Element',sAnt,'Size',[4 4],'ElementSpacing',0.5* lamda);
%****************BEAM STEERING PART**********************************
r= input('Start Phi Angle = ');
q= input('End Phi Angle = ');
u= input('No. of Scans = ');
scanPhi = r:q;
global hScope;
for x=1:u
hScan = phased.SteeringVector('SensorArray',sArray,...'PropagationSpeed',c);
hResponse = phased.ArrayResponse('WeightsInputPort',true,...
'SensorArray',sArray);
scanTheta = zeros(1,numel(scanPhi));
scanAngles = [scanPhi;scanTheta];
weights = step(hScan,fmax,scanAngles); % Calculate Weights for steering
az = -180:180;
el = zeros(1,numel(az));
ang_pairs = [az;el];
if isempty(hScope)
hScope = ArrayResponseDemo2DPolarScope; % Initialize scope
end
for t = 1:length(scanTheta) % Calculate response
w = weights(:,t);
temp_out = abs(step(hResponse,fmax,ang_pairs,w));
temp_out = temp_out/max(temp_out);
% temp_out=20*log10 (temp_out);
pause(0.1);
step(hScope,temp_out); % Display on scope
%disp(w);
m{t}=w;
end
end

ANOTHER CODE
clc; clear all;
close all;
N = 64;
alfa = -90:0.1:90; % Zenith angle
d_l = [0.1,0.5,1,2,5] ; % Ratio
for i = 1:5
Ed = abs(sin(N*pi*d_l(i)*sind(alfa))./sin(pi*d_l(i)*sind(alfa)))/N;
fig = figure(i);
set(fig,'Position', [100, 100, 1049, 400]);
subplot(2,2,[1 3]);
plot(alfa,Ed);
grid on;
axis([-90 90 0 1]);
xlabel('Zenith angle [deg]');
ylabel('Normalized radiation pattern');
title(['Ratio between distance and wavelength d/\lambda = ',num2str(d_l(i))]);

subplot(2,2,[2 4]);
polar(alfa*pi/180,Ed);
hold on;
polar((alfa+180)*pi/180,Ed);
xlabel(['Polar plot for the radiation pattern d/\lambda = ',num2str(d_l(i))]);
hold off;
end
f_EISCAT = 233E6; % Centre frequency 233 Hz
c = 3*10^8; % Light Speed m/s
l = c/f_EISCAT;
d = [0.1,0.5,1,2,3]; % m
for i = 1:5
% Normalizied gain
Ed = abs(sin(N*pi*d(i)/l*sind(alfa))./sin(pi*d(i)/l*sind(alfa)))/N;
% Ed - Array Factor, Radiation patern for isotropic radiators
fig = figure(i+5);
set(fig,'Position', [100, 100, 1049, 400]);
subplot(2,2,[1 3]);
plot(alfa,Ed);
grid on;
axis([-90 90 0 1]);
xlabel('Zenith angle [deg]');
ylabel('Normalized radiation pattern');
title([' Distance between individual elements (space weighting) = ',...
num2str(d (i)),' m, F = 233Mhz']);
subplot(2,2,[2 4]);
polar(alfa*pi/180,Ed);
hold on;
polar((alfa+180)*pi/180,Ed);
xlabel('Polar plot for the radiation pattern');
hold off;
end
d_l = 0.5;
N = [4 16 64 100 169]; % Number of elements was varied from 4 to 256.
for i = 1:5
Ed = abs(sin(pi*d_l*N(i)*sind(alfa))./sin(pi*d_l*sind(alfa)))/N(i);
fig = figure(i+10);
set(fig,'Position', [100, 100, 1049, 400]);
subplot(2,2,[1 3]);
plot(alfa,Ed);
grid on;
axis([-90 90 0 1]);
xlabel('Zenith angle [deg]');
ylabel('Normalized array factor,Radiation pattern');
title(['Number of elements = ',num2str(N(i)),', d/\lambda = 0.5']);
subplot(2,2,[2 4]);
polar(alfa*pi/180,Ed);
hold on;
polar((alfa+180)*pi/180,Ed);
xlabel('Polar plot for the radiation pattern');
hold off;
end
clc;clear all;
N = 8;
d_l = 0.5;
alfa0 = 30;
alfa = -180:0.1:180; % Zenith angle
Ed = abs(sin(pi*d_l*N*(sind(alfa) - sind(alfa0) ))./...
sin(pi*d_l*(sind(alfa) - sind(alfa0))))/N;
Ed0 = abs(sin(pi*d_l*N*(sind(alfa)))./...
sin(pi*d_l*sind(alfa)))/N;
Edl = 20*log10(Ed);
Edl0= 20*log10(Ed0);
fig = figure(16);
set(fig,'Position', [100, 100, 1049, 400]);
subplot(2,2,[1 3]);
plot(alfa,Ed);
hold on;
plot(alfa,Ed0,'r');
grid on;
axis([-90 90 0 1]);
xlabel('Zenith angle [deg]');
ylabel('Normalized array factor,Radiation pattern');
title(['Number of elements = ',num2str(N),', d/\lambda = 0.5']);
legend('\beta = 30 deg','\beta = 0 deg','Location','NorthWest')
subplot(2,2,[2 4]);
polar(alfa*pi/180,Ed);
hold on;
polar(alfa*pi/180,Ed0,'r');
hold on;
xlabel('Polar plot for the radiation pattern');
hold off;
figure(17);
plot(alfa,Edl);
hold on;
plot(alfa,Edl0,'r');
grid on;
legend('\beta = 30 deg','\beta = 0 deg','Location','NorthWest')
axis([-90 90 -100 0]);
xlabel('Zenith angle [deg]');
ylabel('Radiation pattern dB');
title(['Number of elements = ',num2str(N),', d/\lambda = 0.5']);
N = 64;
d_l = 0.1;
Ed = abs(sin(pi*d_l*N*(sind(alfa) ))./...
sin(pi*d_l*sind(alfa)))/N;
Edl = 20*log10(Ed);
% Try to lower the first side lobe relative to main lobe
% To be able to reduce the side lobe levels, we design the array so its radiate
% more power towards the center, and less at the edges.
w = zeros(1,N);
ws = zeros(1,N);
n = 1:N;
E = 0;Es = 0;
for n = 1:N;
if n <= N/2
w(n) = (n-1)/30.5;
else
w(n) = w(65 - n);
end
ws(n) = sin((n-1)*pi/(N-1));
E = E + (w(n)*exp(complex(0,((2*pi*(n-1)*d_l)*sind(alfa)))));
Es = Es + (ws(n)*exp(complex(0,((2*pi*(n-1)*d_l)*sind(alfa)))));
end
figure(19);
hold on; grid on;
plot(w,'g');
plot(ws,'r');
axis([1 64 0 1]);
ylabel('Normalized tapering weight');
xlabel('Array elements index');
legend('polynomial','sin');
hold off;
E = abs(E);
E = 20*log10(E/max(E));
Es = abs(Es);
Es = 20*log10(Es/max(Es));
fig = figure(18);
set(fig,'Position', [100, 100, 600, 700]);
hold on;
subplot(3,1,1);
plot(alfa,Edl);
grid on;
axis([-90 90 -100 0]);
legend('Isotropic');
ylabel('Radiation pattern dB');
title(['Number of elements = ',num2str(N),', d/\lambda = ',num2str(d_l)]);
subplot(3,1,2);
plot(alfa,Es,'r');
axis([-90 90 -100 0]);
ylabel('Radiation pattern dB');
grid on;
legend('Weighted Sin');
subplot(3,1,3);
plot(alfa,E,'g');
axis([-90 90 -100 0]);
grid on;
xlabel('Zenith angle [deg]');
ylabel('Radiation pattern dB');
legend('Weighted Poly');
hold off;

Вам также может понравиться