function [ BEAM, ARMAP , beam_drawing ] = analyzeFAR( MAP, kgrid, center_array, dBvalue)
sourceX=round((center_array)/kgrid.dx);

% =========================================================================
% 31HZ
% =========================================================================
map=MAP.log_rms_31Hz<dBvalue;
collumn_first=ceil(min(find(map(:,:)==0))/length(map(:,1)));
collumn_last=floor(max(find(map(:,:)==0))/length(map(:,1)));

for k=collumn_first:collumn_last
maximas(k)=max(find(map(:,k)==0));
minimas(k)=min(find(map(:,k)==0));
end
beam_FRONT=max(maximas(collumn_first:collumn_last));
beam_REAR=min(minimas(collumn_first:collumn_last));

collumn_first=ceil(min(find(map(:,:).'==0))/length(map(1,:)));
collumn_last=floor(max(find(map(:,:).'==0))/length(map(1,:)));
% Y-coordinates
for k=collumn_first:collumn_last
maximas(k)=max(find(map(k,:)==0));
minimas(k)=min(find(map(k,:)==0));
end
beam_RIGHT=max(maximas(collumn_first:collumn_last));
beam_LEFT=min(minimas(collumn_first:collumn_last));

beam_width=(beam_RIGHT-beam_LEFT)*kgrid.dy;
beam_length=(beam_FRONT-beam_REAR)*kgrid.dx;

%
BEAM.FAR_31Hz=((beam_FRONT-sourceX)*kgrid.dx)/beam_width;
BEAM.BAR_31Hz=((sourceX-beam_REAR)*kgrid.dx)/beam_width;
BEAM.AR_31Hz=BEAM.FAR_31Hz/BEAM.BAR_31Hz;
BEAM.FBAR_31Hz=beam_length/beam_width;
ARMAP.map_31Hz=map;
%
beam_drawing.LEFT_31Hz=beam_LEFT;
beam_drawing.RIGHT_31Hz=beam_RIGHT;
beam_drawing.FRONT_31Hz=beam_FRONT;
beam_drawing.REAR_31Hz=beam_REAR;

% =========================================================================
% 40HZ
% =========================================================================
map=MAP.log_rms_40Hz<dBvalue;
collumn_first=ceil(min(find(map(:,:)==0))/length(map(:,1)));
collumn_last=floor(max(find(map(:,:)==0))/length(map(:,1)));

for k=collumn_first:collumn_last
maximas(k)=max(find(map(:,k)==0));
minimas(k)=min(find(map(:,k)==0));
end
beam_FRONT=max(maximas(collumn_first:collumn_last));
beam_REAR=min(minimas(collumn_first:collumn_last));

collumn_first=ceil(min(find(map(:,:).'==0))/length(map(1,:)));
collumn_last=floor(max(find(map(:,:).'==0))/length(map(1,:)));
% Y-coordinates
for k=collumn_first:collumn_last
maximas(k)=max(find(map(k,:)==0));
minimas(k)=min(find(map(k,:)==0));
end
beam_RIGHT=max(maximas(collumn_first:collumn_last));
beam_LEFT=min(minimas(collumn_first:collumn_last));

beam_width=(beam_RIGHT-beam_LEFT)*kgrid.dy;
beam_length=(beam_FRONT-beam_REAR)*kgrid.dx;

%
BEAM.FAR_40Hz=((beam_FRONT-sourceX)*kgrid.dx)/beam_width;
BEAM.BAR_40Hz=((sourceX-beam_REAR)*kgrid.dx)/beam_width;
BEAM.AR_40Hz=BEAM.FAR_40Hz/BEAM.BAR_40Hz;
BEAM.FBAR_40Hz=beam_length/beam_width;
ARMAP.map_40Hz=map;
%
beam_drawing.LEFT_40Hz=beam_LEFT;
beam_drawing.RIGHT_40Hz=beam_RIGHT;
beam_drawing.FRONT_40Hz=beam_FRONT;
beam_drawing.REAR_40Hz=beam_REAR;


% =========================================================================
% 50HZ
% =========================================================================
map=MAP.log_rms_50Hz<dBvalue;
collumn_first=ceil(min(find(map(:,:)==0))/length(map(:,1)));
collumn_last=floor(max(find(map(:,:)==0))/length(map(:,1)));

for k=collumn_first:collumn_last
maximas(k)=max(find(map(:,k)==0));
minimas(k)=min(find(map(:,k)==0));
end
beam_FRONT=max(maximas(collumn_first:collumn_last));
beam_REAR=min(minimas(collumn_first:collumn_last));

collumn_first=ceil(min(find(map(:,:).'==0))/length(map(1,:)));
collumn_last=floor(max(find(map(:,:).'==0))/length(map(1,:)));
% Y-coordinates
for k=collumn_first:collumn_last
maximas(k)=max(find(map(k,:)==0));
minimas(k)=min(find(map(k,:)==0));
end
beam_RIGHT=max(maximas(collumn_first:collumn_last));
beam_LEFT=min(minimas(collumn_first:collumn_last));

beam_width=(beam_RIGHT-beam_LEFT)*kgrid.dy;
beam_length=(beam_FRONT-beam_REAR)*kgrid.dx;

%
BEAM.FAR_50Hz=((beam_FRONT-sourceX)*kgrid.dx)/beam_width;
BEAM.BAR_50Hz=((sourceX-beam_REAR)*kgrid.dx)/beam_width;
BEAM.AR_50Hz=BEAM.FAR_50Hz/BEAM.BAR_50Hz;

BEAM.FBAR_50Hz=beam_length/beam_width;
ARMAP.map_50Hz=map;
%
beam_drawing.LEFT_50Hz=beam_LEFT;
beam_drawing.RIGHT_50Hz=beam_RIGHT;
beam_drawing.FRONT_50Hz=beam_FRONT;
beam_drawing.REAR_50Hz=beam_REAR;

% =========================================================================
% 63HZ
% =========================================================================
map=MAP.log_rms_63Hz<dBvalue;
collumn_first=ceil(min(find(map(:,:)==0))/length(map(:,1)));
collumn_last=floor(max(find(map(:,:)==0))/length(map(:,1)));

for k=collumn_first:collumn_last
maximas(k)=max(find(map(:,k)==0));
minimas(k)=min(find(map(:,k)==0));
end
beam_FRONT=max(maximas(collumn_first:collumn_last));
beam_REAR=min(minimas(collumn_first:collumn_last));

collumn_first=ceil(min(find(map(:,:).'==0))/length(map(1,:)));
collumn_last=floor(max(find(map(:,:).'==0))/length(map(1,:)));
% Y-coordinates
for k=collumn_first:collumn_last
maximas(k)=max(find(map(k,:)==0));
minimas(k)=min(find(map(k,:)==0));
end
beam_RIGHT=max(maximas(collumn_first:collumn_last));
beam_LEFT=min(minimas(collumn_first:collumn_last));

beam_width=(beam_RIGHT-beam_LEFT)*kgrid.dy;
beam_length=(beam_FRONT-beam_REAR)*kgrid.dx;

%
BEAM.FAR_63Hz=((beam_FRONT-sourceX)*kgrid.dx)/beam_width;
BEAM.BAR_63Hz=((sourceX-beam_REAR)*kgrid.dx)/beam_width;
BEAM.AR_63Hz=BEAM.FAR_63Hz/BEAM.BAR_63Hz;

BEAM.FBAR_63Hz=beam_length/beam_width;
ARMAP.map_63Hz=map;

%
beam_drawing.LEFT_63Hz=beam_LEFT;
beam_drawing.RIGHT_63Hz=beam_RIGHT;
beam_drawing.FRONT_63Hz=beam_FRONT;
beam_drawing.REAR_63Hz=beam_REAR;

% =========================================================================
% 80HZ
% =========================================================================
map=MAP.log_rms_80Hz<dBvalue;
collumn_first=ceil(min(find(map(:,:)==0))/length(map(:,1)));
collumn_last=floor(max(find(map(:,:)==0))/length(map(:,1)));

for k=collumn_first:collumn_last
maximas(k)=max(find(map(:,k)==0));
minimas(k)=min(find(map(:,k)==0));
end
beam_FRONT=max(maximas(collumn_first:collumn_last));
beam_REAR=min(minimas(collumn_first:collumn_last));

collumn_first=ceil(min(find(map(:,:).'==0))/length(map(1,:)));
collumn_last=floor(max(find(map(:,:).'==0))/length(map(1,:)));
% Y-coordinates
for k=collumn_first:collumn_last
maximas(k)=max(find(map(k,:)==0));
minimas(k)=min(find(map(k,:)==0));
end
beam_RIGHT=max(maximas(collumn_first:collumn_last));
beam_LEFT=min(minimas(collumn_first:collumn_last));

beam_width=(beam_RIGHT-beam_LEFT)*kgrid.dy;
beam_length=(beam_FRONT-beam_REAR)*kgrid.dx;

%
BEAM.FAR_80Hz=((beam_FRONT-sourceX)*kgrid.dx)/beam_width;
BEAM.BAR_80Hz=((sourceX-beam_REAR)*kgrid.dx)/beam_width;
BEAM.AR_80Hz=BEAM.FAR_80Hz/BEAM.BAR_80Hz;

BEAM.FBAR_80Hz=beam_length/beam_width;
ARMAP.map_80Hz=map;
%
beam_drawing.LEFT_80Hz=beam_LEFT;
beam_drawing.RIGHT_80Hz=beam_RIGHT;
beam_drawing.FRONT_80Hz=beam_FRONT;
beam_drawing.REAR_80Hz=beam_REAR;

% =========================================================================
% 100HZ
% =========================================================================
map=MAP.log_rms_100Hz<dBvalue;
collumn_first=ceil(min(find(map(:,:)==0))/length(map(:,1)));
collumn_last=floor(max(find(map(:,:)==0))/length(map(:,1)));

for k=collumn_first:collumn_last
maximas(k)=max(find(map(:,k)==0));
minimas(k)=min(find(map(:,k)==0));
end
beam_FRONT=max(maximas(collumn_first:collumn_last));
beam_REAR=min(minimas(collumn_first:collumn_last));

collumn_first=ceil(min(find(map(:,:).'==0))/length(map(1,:)));
collumn_last=floor(max(find(map(:,:).'==0))/length(map(1,:)));
% Y-coordinates
for k=collumn_first:collumn_last
maximas(k)=max(find(map(k,:)==0));
minimas(k)=min(find(map(k,:)==0));
end
beam_RIGHT=max(maximas(collumn_first:collumn_last));
beam_LEFT=min(minimas(collumn_first:collumn_last));

beam_width=(beam_RIGHT-beam_LEFT)*kgrid.dy;
beam_length=(beam_FRONT-beam_REAR)*kgrid.dx;

%
BEAM.FAR_100Hz=((beam_FRONT-sourceX)*kgrid.dx)/beam_width;
BEAM.BAR_100Hz=((sourceX-beam_REAR)*kgrid.dx)/beam_width;
BEAM.AR_100Hz=BEAM.FAR_100Hz/BEAM.BAR_100Hz;

BEAM.FBAR_100Hz=beam_length/beam_width;
ARMAP.map_100Hz=map;
%
beam_drawing.LEFT_100Hz=beam_LEFT;
beam_drawing.RIGHT_100Hz=beam_RIGHT;
beam_drawing.FRONT_100Hz=beam_FRONT;
beam_drawing.REAR_100Hz=beam_REAR;

end

