diff --git a/RTX class/FarField.m b/RTX class/FarField.m index f736e1fda7b6a3e0107cf9b50e746170f7815376..3d7498b96e56bf2f4a8210119e6e729239f3c38d 100644 --- a/RTX class/FarField.m +++ b/RTX class/FarField.m @@ -29,7 +29,8 @@ classdef FarField < handle nr = floor(length(histogram)/2); r = linspace(0, obj.aperture.size/2, nr); c1 = (obj.aperture.size/(2*nr))*2*pi/obj.nFi; - c2 = 1i*2*pi/obj.wavelength; + c2 = 1i*2*pi/obj.wavelength; + for i = 1:nTheta if getappdata(progressBar2,'canceling') @@ -48,6 +49,10 @@ classdef FarField < handle end end end + + R = 2*obj.aperture.size^2/obj.wavelength; + field = field * (exp(-1i*2*pi*R/obj.wavelength)/obj.wavelength/R); + obj.field = field; delete(progressBar2) end @@ -58,11 +63,22 @@ classdef FarField < handle end figure; y = abs(obj.field); - y = y/max(y); + %y = y/max(y); plot(obj.theta*180/pi, 20*log10(y)); title("Távoltér"); xlabel("\Theta [°]"); ylabel("S [dB]"); - end + end + + function beamWidth = getBeamWidth(obj) + if isempty(obj.field) + obj.calculate(); + end + normField = abs(obj.field)/max(abs(obj.field)); + maxIndex = find(normField == 1, 1); + localMins = islocalmin(normField); + localMinIndexes = find(localMins == 1); + beamWidth = (min(abs(localMinIndexes - maxIndex))+1)*(obj.theta(2)-obj.theta(1))*2 + end end end