Matlab code for Broadside Array in 3-D

3
MATLAB code for Broadside Array in 3D -- GUNJAN GUPTA -- -- 10BEC112 -- -- EXP 11 -- %% Pre-initialisation clear; clc; close all; %% Accepting inputs N = input('\nEnter the number of Elements::(eg., 5,6,7,etc)->'); d = input('\nEnter the distance between the elements::(eg.,0.4,0.5,etc)->'); tic; [theta phi] = meshgrid(linspace(0,2*pi,180)); k = 2*pi; c = (k.*d)./2; %% Calculating Array element(AE) and Array Factor(AF) num = ((1./N).*sin(N.*c.*cos(theta))); den = sin(c.*cos(theta)); AF = num./den; AF = AF - min(min(AF)); AE = sqrt(1- ((sin(theta).^2).*(cos(phi).^2))); %% Calculating Array Pattern(AP) % Array Pattern is calculated as follows, % % Array Pattern = ArrayFactor * ArrayElement AP = AF .* AE; toc; %% Plotting results [x1,y1,z1] = sph2cart(phi,theta,AE); surf(x1,y1,z1,'FaceLighting','phong',... 'LineStyle','none',... 'FaceColor',[1 0 0]); legend('Array Element','Location','SouthEastOutside') axis image light('Style','local',... 'Position',[-10.162701816704 -0.924193626363743 14.9951905283833]); figure

description

Matlab code for Broadside Array in 3-D

Transcript of Matlab code for Broadside Array in 3-D

Page 1: Matlab code for Broadside Array in 3-D

MATLAB code for Broadside Array in 3D -- GUNJAN GUPTA -- -- 10BEC112 -- -- EXP 11 -- %% Pre-initialisation clear; clc; close all;

%% Accepting inputs

N = input('\nEnter the number of Elements::(eg., 5,6,7,etc)->'); d = input('\nEnter the distance between the elements::(eg.,0.4,0.5,etc)->');

tic;

[theta phi] = meshgrid(linspace(0,2*pi,180)); k = 2*pi; c = (k.*d)./2;

%% Calculating Array element(AE) and Array Factor(AF)

num = ((1./N).*sin(N.*c.*cos(theta))); den = sin(c.*cos(theta)); AF = num./den; AF = AF - min(min(AF));

AE = sqrt(1- ((sin(theta).^2).*(cos(phi).^2)));

%% Calculating Array Pattern(AP)

% Array Pattern is calculated as follows, % % Array Pattern = ArrayFactor * ArrayElement

AP = AF .* AE;

toc;

%% Plotting results

[x1,y1,z1] = sph2cart(phi,theta,AE);

surf(x1,y1,z1,'FaceLighting','phong',... 'LineStyle','none',... 'FaceColor',[1 0 0]);

legend('Array Element','Location','SouthEastOutside')

axis image

light('Style','local',... 'Position',[-10.162701816704 -0.924193626363743 14.9951905283833]);

figure

Page 2: Matlab code for Broadside Array in 3-D

[x2,y2,z2] = sph2cart(phi,theta,AF);

surf(x2,y2,z2,'FaceLighting','phong',... 'LineStyle','none',... 'FaceColor',[1 0 0]);

legend('Array Factor','Location','SouthEastOutside')

axis image

light('Style','local',... 'Position',[-10.162701816704 -0.924193626363743 14.9951905283833]);

figure

[x3,y3,z3] = sph2cart(phi,theta,AP);

surf(x3,y3,z3,'FaceLighting','phong',... 'LineStyle','none',... 'FaceColor',[1 0 0]);

legend('Array Pattern of Broadside array','Location','SouthEastOutside')

axis image

light('Style','local',... 'Position',[-10.162701816704 -0.924193626363743 14.9951905283833]);

ON SIMULATION RESULT:

Enter the number of Elements ::(eg., 5,6,7,etc)->5

Enter the distance between the elements ::(eg.,0.4,0.5,etc)->0.4

Elapsed time is

0.354325 seconds.

-0.50

0.51

-0.5

0

0.5

-0.5

0

0.5

Array Element

Page 3: Matlab code for Broadside Array in 3-D

-0.4-0.2

00.2

0.4

-0.4-0.20

0.20.4

-1

-0.5

0

0.5

1

Array Pattern of Broadside array

-0.4-0.2

00.2

0.4

-0.4-0.20

0.20.4

-1

-0.5

0

0.5

1

Array Factor