diff --git a/RTX class/BalazsAperture.m b/RTX class/BalazsAperture.m index 3f5690687cf03562c335882151064e0b6c8abc28..46abc084f355f88123e88ac4e76edc9fc53ff9ae 100644 --- a/RTX class/BalazsAperture.m +++ b/RTX class/BalazsAperture.m @@ -30,14 +30,16 @@ classdef BalazsAperture < Aperture x = linspace(-obj.size/2, obj.size/2, length(histogram)); subplot(2,1,1); - stem(x, abs(histogram),'MarkerSize',0.001); +% stem(x, abs(histogram),'MarkerSize',0.001); + plot(x, abs(histogram)); title("Apertúra megvilágítsáfüggvénye - amplitúdó"); xlabel("r'"); ylabel("|E(r')| [V/m]"); xlim([-obj.size/2, obj.size/2]); subplot(2,1,2); - stem(x, angle(histogram),'MarkerSize',0.001); + %stem(x, angle(histogram),'MarkerSize',0.001); + plot(x, angle(histogram)); title("Apertúra megvilágításfüggvénye - fázis"); xlabel("r'"); ylabel("arg|E(r')| [rad]"); diff --git a/RTX class/SegmentedAperture.m b/RTX class/SegmentedAperture.m index aa1baca482869d9065be92a0b421396e12980054..494bc8a59e9810038b3414250ce7cf695f39a60a 100644 --- a/RTX class/SegmentedAperture.m +++ b/RTX class/SegmentedAperture.m @@ -38,6 +38,9 @@ classdef SegmentedAperture < Aperture function plotApertureField(obj) [histogram,x1, x2] = obj.getCollisionHistogram(); + x1 = [-obj.size/2, x1, x1(end)]; + x2 = [x1(2), x2, obj.size/2]; + histogram = [0 histogram 0]; x = [x1; x2]; h = [histogram; histogram]; diff --git a/RTX class/rtx_test.m b/RTX class/rtx_test.m index 0fe898c21cd3e818ee5cea20d65bea08702d5699..79db9531fc3258a7a9f0a3a5e483dfd8bb33f4c9 100644 --- a/RTX class/rtx_test.m +++ b/RTX class/rtx_test.m @@ -5,11 +5,11 @@ 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); -antenna = Antenna(Vect(1,0), [ones(1,1250), zeros(1,7500), ones(1,1250)], zeros(1,10000)); +antenna = Antenna(Vect(1,0), [ones(1,125), zeros(1,750), ones(1,125)], zeros(1,1000)); %antenna = Antenna(Vect(1,0), ones(1,10000), zeros(1,10000)); wavelength = 3e8/1e9; nRay = 10000; -nRay2 = 2000; +nRay2 = 1000; rtx = RTX(reflectors, aperture, antenna, wavelength, nRay); rtx.trace(); diff --git a/RTX class/sim1.m b/RTX class/sim1.m index ba4e351a34323c5e1104b592bb375b35879a7da1..c2cfda26be63b031ec2cac38d18be171c6e1a1e7 100644 --- a/RTX class/sim1.m +++ b/RTX class/sim1.m @@ -1,42 +1,24 @@ 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; +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); +antenna = Antenna(Vect(1,0), [ones(1,125), zeros(1,750), ones(1,125)], zeros(1,1000)); +%antenna = Antenna(Vect(1,0), ones(1,10000), zeros(1,10000)); +wavelength = 3e8/1e9; +nRay = 10000; +nRay2 = 2000; - 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 +rtx = RTX(reflectors, aperture, antenna, wavelength, nRay); +rtx.trace(); +figure; rtx.plotApertureField(); +figure; rtx.plotFarField(); +rtx2 = RTX(reflectors, aperture2, antenna, wavelength, nRay2); +rtx2.trace(); +figure; rtx2.plotApertureField(); +figure; rtx2.plotFarField(); +dir = rtx.calcDirectivity(); diff --git a/RTX class/sim_antpos.m b/RTX class/sim_antpos.m new file mode 100644 index 0000000000000000000000000000000000000000..33f1f05835c0e67966163113bd96b4f54311c01c --- /dev/null +++ b/RTX class/sim_antpos.m @@ -0,0 +1,55 @@ +clear +close all + +antPhi = 360/180*pi; +antPos = linspace(0.5, 1.5, 5); +planeRefSize = 2;%linspace(1.8, 2.2, 5); +parabSize = 4; +lambda = 0.3; +dirs = zeros(1,length(antPos)); +beamWidth = zeros(1,length(antPos)); +rtx = RTX.empty(); +%freq = []; +for k = 1:length(antPos) +% wavelength = 3e8/freq(k); + reflectors = [PlaneReflector([2 0], planeRefSize), ParabolaReflector([0 0], parabSize, 3)]; + %reflectors = [PlaneReflector([-1 1], 0)]; + aperture2 = SegmentedAperture([2.0001 0], 20); + antAngle = 90; + + antenna = Antenna(Vect(antPos(k),0), [ones(1,125), zeros(1,750), ones(1,125)], zeros(1,1000)); +% antenna = Antenna(Vect(antPos(k),0)); + %wavelength = 3e8/1e9; + nRay2 = 1000; + + rtx(k) = RTX(reflectors, aperture2, antenna, lambda, nRay2); + rtx(k).trace(); + figure(1); + 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(2); + hold on; + rtx(k).plotFarField(); + hold off; +% rtx2.calculateFarField(); + + dirs(k) = rtx(k).calcDirectivity(); + beamWidth(k) = rtx(k).farField.getBeamWidth(); +end + +figure(3); +subplot(2, 1, 1); +scatter(antPos, beamWidth, 'x'); +subplot(2, 1, 2); +scatter(antPos, dirs, 'x'); + + + diff --git a/RTX class/sim_ap.m b/RTX class/sim_ap.m new file mode 100644 index 0000000000000000000000000000000000000000..5164daa7901d00cb7d1c922230322e6d9b0827fc --- /dev/null +++ b/RTX class/sim_ap.m @@ -0,0 +1,48 @@ +clear +close all + +antPhi = 360/180*pi; +antPos = 1;%linspace(0.8, 1.2, 3); +planeRefSize = 2;%linspace(1.8, 2.2, 5); +parabSize = [3 4 6 8 10]; +dirs = zeros(length(parabSize)); +beamWidth = zeros(length(parabSize)); +rtx = RTX.empty(); +for k = 1:length(antPos) + for m = 1:length(planeRefSize) + for n = 1:length(parabSize) + reflectors = [PlaneReflector([2 0], planeRefSize(m)), ParabolaReflector([0 0], parabSize(n), 3)]; + %reflectors = [PlaneReflector([-1 1], 0)]; + aperture2 = SegmentedAperture([2.0001 0], 20); + antenna = Antenna(Vect(antPos(k),0), [ones(1,125), zeros(1,750), ones(1,125)], zeros(1,1000)); + % antenna = Antenna(Vect(antPos(k),0)); + wavelength = 3e8/1e9; + nRay2 = 1000; + + clear rtx2; + rtx(n) = RTX(reflectors, aperture2, antenna, wavelength, nRay2); + rtx(n).trace(); + figure(3); + subplot(2,1,1); + hold on; + subplot(2,1,2); + hold on; + rtx(n).plotApertureField(); + subplot(2,1,1); + hold off; + subplot(2,1,2); + hold off; + + figure(4); + hold on; + rtx(n).plotFarField(); + hold off; + % rtx2.calculateFarField(); + + dirs(n) = rtx(n).calcDirectivity(); + beamWidth(n) = rtx(n).farField.getBeamWidth(); + end + end +end + + diff --git a/RTX class/sim_freq.m b/RTX class/sim_freq.m new file mode 100644 index 0000000000000000000000000000000000000000..76579a14e3ddf1c201574678ce3aac546a8b0c72 --- /dev/null +++ b/RTX class/sim_freq.m @@ -0,0 +1,58 @@ +clear +close all + +antPhi = 360/180*pi; +antPos = 1;%linspace(0.8, 1.2, 3); +planeRefSize = 2;%linspace(1.8, 2.2, 5); +parabSize = 4; +lambda = [0.05 0.1 0.2 0.5 1]; +dirs = zeros(1,length(lambda)); +beamWidth = zeros(1,length(lambda)); +rtx = RTX.empty(); +%freq = []; +for k = 1:length(lambda) +% wavelength = 3e8/freq(k); + reflectors = [PlaneReflector([2 0], planeRefSize), ParabolaReflector([0 0], parabSize, 3)]; + %reflectors = [PlaneReflector([-1 1], 0)]; + aperture2 = SegmentedAperture([2.0001 0], 20); + antenna = Antenna(Vect(antPos,0), [ones(1,125), zeros(1,750), ones(1,125)], zeros(1,1000)); +% antenna = Antenna(Vect(antPos(k),0)); + %wavelength = 3e8/1e9; + nRay2 = 1000; + + clear rtx2; + rtx(k) = RTX(reflectors, aperture2, antenna, lambda(k), nRay2); + rtx(k).trace(); + figure(1); + 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(2); + hold on; + rtx(k).plotFarField(); + hold off; +% rtx2.calculateFarField(); + + dirs(k) = rtx(k).calcDirectivity(); + beamWidth(k) = rtx(k).farField.getBeamWidth(); +end + +kozel = 2*lambda/parabSize/pi*180; +figure(3); +subplot(2, 1, 1); +scatter(lambda, kozel, 'o'); +hold on; +scatter(lambda, beamWidth, 'x'); +hold off; +subplot(2, 1, 2); +scatter(lambda, dirs, 'x'); + + + diff --git a/RTX class/sim_planesize.m b/RTX class/sim_planesize.m new file mode 100644 index 0000000000000000000000000000000000000000..17e3416a0880ad19947e269cd0f03182af3c4fff --- /dev/null +++ b/RTX class/sim_planesize.m @@ -0,0 +1,54 @@ +clear +close all + +antPhi = 360/180*pi; +antPos = 1;%linspace(0.5, 1.5, 5); +planeRefSize = linspace(2, 3.5, 5); +parabSize = 4; +lambda = 0.3; +dirs = zeros(1,length(planeRefSize)); +beamWidth = zeros(1,length(planeRefSize)); +rtx = RTX.empty(); +%freq = []; +for k = 1:length(planeRefSize) +% wavelength = 3e8/freq(k); + reflectors = [PlaneReflector([2 0], planeRefSize(k)), ParabolaReflector([0 0], parabSize, 3)]; + %reflectors = [PlaneReflector([-1 1], 0)]; + aperture2 = SegmentedAperture([2.0001 0], 20); + + antenna = Antenna(Vect(antPos,0), [ones(1,125), zeros(1,750), ones(1,125)], zeros(1,1000)); +% antenna = Antenna(Vect(antPos(k),0)); + %wavelength = 3e8/1e9; + nRay2 = 1000; + + rtx(k) = RTX(reflectors, aperture2, antenna, lambda, nRay2); + rtx(k).trace(); + figure(1); + 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(2); + hold on; + rtx(k).plotFarField(); + hold off; +% rtx2.calculateFarField(); + + dirs(k) = rtx(k).calcDirectivity(); + beamWidth(k) = rtx(k).farField.getBeamWidth(); +end + +figure(3); +subplot(2, 1, 1); +scatter(planeRefSize, beamWidth, 'x'); +subplot(2, 1, 2); +scatter(planeRefSize, dirs, 'x'); + + + diff --git a/RTX class/testSegmentArray.m b/RTX class/testSegmentArray.m index 0570f15ef43faddb9a3e54b2261033d483bf1d67..a7cb0ce9006460a87bf0e0e946a8b6fcd7d3ee45 100644 --- a/RTX class/testSegmentArray.m +++ b/RTX class/testSegmentArray.m @@ -1,20 +1,25 @@ segs = SegmentArray(); -% segs.add(Segment(4, 10, 1)); -% segs.add(Segment(4, 8, 1)); -% segs.add(Segment(7, 8, 1)); -for k = 1:10 - segs.add(Segment(randi(200),randi(200),randi(20))); -end +segs.add(Segment(0, 7, 3)); +segs.add(Segment(4, 9, 4)); +%segs.add(Segment(7, 8, 1)); +% for k = 1:10 +% segs.add(Segment(randi(20),randi(20),randi(10)+3)); +% end y = [1:length(segs.segs); 1:length(segs.segs)]; y = y(:)'; figure(1); -plot(0,0); +plot(segs.segs(1).posStart, 0.5, 'r', 'LineWidth', 2); hold on; +plot(segs.segs(1).posStart, 0.5, 'b', 'LineWidth', 2); dens = [segs.segs.powDens]; L = strsplit(sprintf('%.1f\n', dens(:)), '\n'); for k = 1:length(segs.segs) - plot([segs.segs(k).posStart, segs.segs(k).posEnd], [k+0.5 k+0.5], 'r'); - text(segs.segs(k).posStart, k+0.5, L(k)); + pstart = segs.segs(k).posStart; + pend = segs.segs(k).posEnd; + plot([pstart, pend], [k+0.5 k+0.5], 'r', 'LineWidth', 2); + plot([pstart, pstart], [k+0.4, k+0.6], 'r', 'LineWidth', 2); + plot([pend, pend], [k+0.4, k+0.6], 'r', 'LineWidth', 2); + text(pstart+0.05, k+0.6, L(k)); end segs1 = segs; % segs.doTheThing(); @@ -22,7 +27,16 @@ segs = segs.doTheThing2(); dens = [segs.segs.powDens]; L = strsplit(sprintf('%.1f\n', dens(:)), '\n'); for k = 1:length(segs.segs) - plot([segs.segs(k).posStart, segs.segs(k).posEnd], [k k], 'b'); - text(segs.segs(k).posStart, k, L(k)); + pstart = segs.segs(k).posStart; + pend = segs.segs(k).posEnd; + plot([pstart, pend], [k k], 'b', 'LineWidth', 2); + plot([pstart, pstart], [k-0.1, k+0.1], 'b', 'LineWidth', 2); + plot([pend, pend], [k-0.1, k+0.1], 'b', 'LineWidth', 2); + text(pstart+0.05, k+0.1, L(k)); end -hold off; \ No newline at end of file +hold off; +xlabel('Pozíció'); +title('Apertúra szakaszok szétválasztása'); +grid on; +legend('Eredeti', 'Szétválasztott', 'Location', 'southeast'); +yticks([]); \ No newline at end of file