diff --git a/RTX class/Antenna.m b/RTX class/Antenna.m
index da794f5bcf26ff19058bfbab803ac3f1704c0107..ece9491d1e9c56cbf845a785d163e55f432aaf44 100644
--- a/RTX class/Antenna.m	
+++ b/RTX class/Antenna.m	
@@ -80,9 +80,9 @@ classdef Antenna
                 [~, start_index] = min(abs(data_phi - phi(j)));
                 [~, stop_index] = min(abs(data_phi - phi(j+1)));
                 for k = start_index:stop_index
-                    if j ~= 1 && k == start_index
-                       continue;
-                    end
+%                    if j ~= 1 && k == start_index
+%                       continue;
+%                    end
                     rpower(j) = rpower(j) + obj.amplitude(k) * dphi;
                 end
                 rphase(j) = obj.phase(ceil((start_index + stop_index) / 2));
diff --git a/RTX class/BalazsAperture.m b/RTX class/BalazsAperture.m
index 2620436caa0ecb68128b10fcf87f7d1efde5c456..3f5690687cf03562c335882151064e0b6c8abc28 100644
--- a/RTX class/BalazsAperture.m	
+++ b/RTX class/BalazsAperture.m	
@@ -27,7 +27,6 @@ classdef BalazsAperture < Aperture
         
         function plotApertureField(obj)
             histogram = obj.getCollisionHistogram();
-            figure;            
             x = linspace(-obj.size/2, obj.size/2, length(histogram));
             
             subplot(2,1,1);
@@ -56,7 +55,7 @@ classdef BalazsAperture < Aperture
             dr = r(2)-r(1);
             num = abs(2*pi*sum(r.*E)*dr)^2;
             den = sum(abs(2*pi*sum(r.*E)*dr).^2);
-            directivity = 4*pi*num/den/wavelength^2;
+            directivity = 10*log10(4*pi*num/den/wavelength^2);
         end
         
         function sumE = calcSumE(obj, wavelength)
diff --git a/RTX class/FarField.m b/RTX class/FarField.m
index af94b1251504fdd28e8d8aa68d08f29ae499b8d8..d4209e87e2dbd031306778d7b717920f082d1439 100644
--- a/RTX class/FarField.m	
+++ b/RTX class/FarField.m	
@@ -82,7 +82,6 @@ classdef FarField < handle
             if isempty(obj.field)
                 obj.calculate();
             end
-            figure;
             y = abs(obj.field);
             y = y/max(y);
             plot(obj.theta*180/pi, 20*log10(y));
@@ -98,10 +97,10 @@ classdef FarField < handle
             end
             normField = abs(obj.field)/max(abs(obj.field));
             maxIndex = find(normField == 1, 1);
-            localMins = islocalmin(normField);
+            localMins = islocalmin(normField) & (normField < 0.4);
             localMinIndexes = find(localMins == 1);
             dTheta = (obj.theta(2)-obj.theta(1));
-            beamWidth = sum(mink(abs(localMinIndexes - maxIndex), 2))*dTheta;           
+            beamWidth = sum(mink(abs(localMinIndexes - maxIndex), 2))*dTheta/pi*180;
         end
     end
 end
diff --git a/RTX class/SegmentedAperture.m b/RTX class/SegmentedAperture.m
index ad93423cd9b691bc1f04631060f6a0929b9a9e7f..4e21c9d8c866a9845d1172c9c217fd56782845c3 100644
--- a/RTX class/SegmentedAperture.m	
+++ b/RTX class/SegmentedAperture.m	
@@ -33,7 +33,6 @@ classdef SegmentedAperture < Aperture
         end
         
         function plotApertureField(obj)
-            figure;
             [histogram,x1, x2] = obj.getCollisionHistogram();
             x = [x1; x2];
             h = [histogram; histogram];
@@ -68,8 +67,8 @@ classdef SegmentedAperture < Aperture
             r = starts;
             dr = ends-starts;
             num = abs(2*pi*sum(r.*E.*dr))^2;
-            den = sum(abs(2*pi*sum(r.*E.*dr)).^2);
-            directivity = 4*pi*num/den/wavelength^2;
+            den = 2*pi*sum(r.*abs(E).^2.*dr);
+            directivity = 10*log10(4*pi*num/den/wavelength^2);
         end
         
         function sumE = calcSumE(obj, wavelength)
diff --git a/RTX class/rtx_test.m b/RTX class/rtx_test.m
index 1a6f1007859b28aa692c67089e0f39fcf6199780..0fe898c21cd3e818ee5cea20d65bea08702d5699 100644
--- a/RTX class/rtx_test.m	
+++ b/RTX class/rtx_test.m	
@@ -1,7 +1,7 @@
 clear
 close all
 
-reflectors = [PlaneReflector([2 0], 0), ParabolaReflector([0 0], 4, 3)];
+reflectors = [PlaneReflector([2 0], 2), ParabolaReflector([0 0], 4, 3)];
 %reflectors = [PlaneReflector([-1 1], 0)];
 aperture = BalazsAperture([2.0001 0], 20, 1000);
 aperture2 = SegmentedAperture([2.0001 0], 20);
diff --git a/RTX class/sim1.m b/RTX class/sim1.m
new file mode 100644
index 0000000000000000000000000000000000000000..ba4e351a34323c5e1104b592bb375b35879a7da1
--- /dev/null
+++ b/RTX class/sim1.m	
@@ -0,0 +1,42 @@
+clear
+close all
+
+antPhi = 360/180*pi;
+antPos = linspace(0.8, 1.2, 3);
+dirs = zeros(size(antPos));
+beamWidth = zeros(size(antPos));
+rtx = RTX.empty();
+for k = 1:length(antPos)
+    reflectors = [PlaneReflector([2 0], 0), ParabolaReflector([10 0], 0, 3)];
+    %reflectors = [PlaneReflector([-1 1], 0)];
+    aperture2 = SegmentedAperture([2.0001 0], 20);
+     antenna = Antenna(Vect(antPos(k),0), [ones(1,250), zeros(1,500), ones(1,249)], zeros(1,999));
+%     antenna = Antenna(Vect(antPos(k),0));
+    wavelength = 3e8/1e9;
+    nRay2 = 1000;
+
+    clear rtx2;
+    rtx(k) = RTX(reflectors, aperture2, antenna, wavelength, nRay2);
+    rtx(k).trace();
+    figure(3);
+    subplot(2,1,1);
+    hold on;
+    subplot(2,1,2);
+    hold on;
+    rtx(k).plotApertureField();
+    subplot(2,1,1);
+    hold off;
+    subplot(2,1,2);
+    hold off;
+    
+    figure(4);
+    hold on;
+    rtx(k).plotFarField();
+    hold off;
+%     rtx2.calculateFarField();
+    
+    dirs(k) = rtx(k).calcDirectivity();
+    beamWidth(k) = rtx(k).farField.getBeamWidth();
+end
+
+