diff --git a/RTX class/Antenna.m b/RTX class/Antenna.m index 1afd6347a348976898e0cd3034919159b1435960..29eb040f924a00363ff78bf7ec7a560632608dee 100644 --- a/RTX class/Antenna.m +++ b/RTX class/Antenna.m @@ -1,9 +1,9 @@ classdef Antenna properties + position Vect; amplitude = ones(1, 1000); phase = zeros(1, 1000); - integral; - position Vect; + integral = zeros(1, 1000); end methods @@ -15,7 +15,7 @@ classdef Antenna end dPhi = 2 * pi / length(obj.amplitude); for j=1:length(obj.amplitude) - obj.integral(j) = sum(amplitude(1:j)*dPhi); + obj.integral(j) = sum(obj.amplitude(1:j)*dPhi); end end diff --git a/RTX class/BalazsAperture.m b/RTX class/BalazsAperture.m index 28dc8245558ad1b8fa2dcab9211fdca4fc97fbf6..f4f737b04ecbe9b9b909532f5304b7461a4d0ef3 100644 --- a/RTX class/BalazsAperture.m +++ b/RTX class/BalazsAperture.m @@ -1,11 +1,7 @@ -classdef BalazsAperture < Barrier +classdef BalazsAperture < Aperture properties - center Vect = Vect; % center position - size double = 0; % full size of reflector (end to end) - color = [0.5 0.5 0.5]; - width = 2; nslice = 1; %change from original - collisions = 0; + collisions = []; end methods function obj = BalazsAperture(center, size, nslice) @@ -16,22 +12,11 @@ classdef BalazsAperture < Barrier obj.collisions = zeros(1, nslice); end end - function col = collide(obj, ray) % override this function with custom collision - col = Collision; - col.stop = true; - - k = (obj.center.x - ray.start.x)/ray.dir.x; - col.pos = ray.start + k*ray.dir; - col.reflDir = Vect(-ray.dir.x, ray.dir.y); - if abs(col.pos.y - obj.center.y) < obj.size/2 && k*ray.dir.mag > 1e-6 - col.collided = true; - else - col.collided = false; - end - end + function histogram = getCollisionHistogram(obj) %change from original histogram = obj.collisions; end + function post_collide(obj, col, trace) if (col.collided) %change from original i = floor(obj.nslice*(col.pos.y-obj.center.y+obj.size/2)/obj.size) + 1; @@ -39,10 +24,6 @@ classdef BalazsAperture < Barrier obj.collisions(i) = obj.collisions(i) + exp(1i*phase); end end - function plot_self(obj) - plot([obj.center.x obj.center.x],... - [obj.center.y - obj.size/2, obj.center.y + obj.size/2],... - 'LineWidth', obj.width, 'Color', obj.color); - end + end end diff --git a/RTX class/FarField.m b/RTX class/FarField.m index 63ac71dec7011d49901460d082a8a2e4c0ea6bbb..78f176b3d2600c5932d12b631335f629f35bf99e 100644 --- a/RTX class/FarField.m +++ b/RTX class/FarField.m @@ -5,19 +5,20 @@ classdef FarField end methods (Static) - function field = CalculateFarField(ntheta, nfi, apertureSize, wavelength, histogram) + function field = CalculateFarField(ntheta, nfi, apertureSize, wavelength, histogram) progressBar2 = waitbar(0,'Calculating far field...','Name','Calculating far field...',... 'CreateCancelBtn','setappdata(gcbf,''canceling'',1)'); setappdata(progressBar2,'canceling',0); stepSize = ntheta/100; - + field = zeros(1, ntheta); theta = linspace(-pi/6, pi/6, ntheta); fi = linspace(0, 2*pi, nfi); nr = floor(length(histogram)/2); r = linspace(0, apertureSize/2, nr); c1 = (apertureSize/(2*nr))*2*pi/nfi; - c2 = 1i*2*pi/wavelength; + c2 = 1i*2*pi/wavelength; + for i = 1:ntheta if getappdata(progressBar2,'canceling') break;