diff --git a/RTX class/BalazsAperture.m b/RTX class/BalazsAperture.m index 46abc084f355f88123e88ac4e76edc9fc53ff9ae..e0ea8701694247b7dd0fb305b17b8feefee0700a 100644 --- a/RTX class/BalazsAperture.m +++ b/RTX class/BalazsAperture.m @@ -25,7 +25,7 @@ classdef BalazsAperture < Aperture end end - function plotApertureField(obj) + function [x, y] = plotApertureField(obj) histogram = obj.getCollisionHistogram(); x = linspace(-obj.size/2, obj.size/2, length(histogram)); @@ -48,6 +48,7 @@ classdef BalazsAperture < Aperture yticks([-pi, -3*pi/4, -pi/2, -pi/4, 0, pi/4, pi/2, 3*pi/4, pi]); yticklabels({'-\pi', '', '-^{1}/_{2}\pi', '',... '0', '', '^{1}/_{2}\pi', '', '\pi'}); + y = histogram; end function directivity = calcDirectivity(obj, wavelength) diff --git a/RTX class/sim_diff.m b/RTX class/sim_diff.m new file mode 100644 index 0000000000000000000000000000000000000000..a2bfd6986a2cf370d2ed51376bb131a44c5b296d --- /dev/null +++ b/RTX class/sim_diff.m @@ -0,0 +1,89 @@ +clear +close all + +reflectors = [PlaneReflector([2 0], 2), ParabolaReflector([0 0], 4, 3)]; +%reflectors = [PlaneReflector([-1 1], 0)]; +aperture1 = 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; + +rtx1 = RTX(reflectors, aperture1, antenna, wavelength, nRay); +rtx1.trace(); +rtx1.calculateFarField(); +rtx2 = RTX(reflectors, aperture2, antenna, wavelength, nRay2); +rtx2.trace(); +rtx2.calculateFarField(); + +%% Plot settings + +plot_width = 1200; +h_width = plot_width * 0.55; +height = 400; +file_format = 'png'; +save_plot = 1; + +%% Sim_characteristics_aperture_field + +[x1, y1] = rtx1.plotApertureField(); +[x2, y2] = rtx2.plotApertureField(); +close all; + +figure(1) +subplot(2,1,1); +hold on; +plot(x1, abs(y1), 'b', 'LineWidth', 1); +plot(x2, abs(y2), 'r', 'LineWidth', 1); +hold off +grid on; +xlabel("r'"); +ylabel("|E(r')| [V/m]"); +xlim([-5, 5]); +title("Cassegrain antenna megvilágítási függvénye"); +legend('1. módszer', '2. módszer', 'Location', 'northeast', 'Orientation', 'vertical'); + +subplot(2,1,2); +hold on; +plot(x1, angle(y1), 'b', 'LineWidth', 1); +plot(x2, angle(y2), 'r', 'LineWidth', 1); +hold off +grid on; +xlabel("r'"); +ylabel("argE(r') [rad]"); +xlim([-5, 5]); +ylim([-pi, pi]); +yticks([-pi, -3*pi/4, -pi/2, -pi/4, 0, pi/4, pi/2, 3*pi/4, pi]); +yticklabels({'-\pi', '', '-^{1}/_{2}\pi', '',... + '0', '', '^{1}/_{2}\pi', '', '\pi'}); +legend('1. módszer', '2. módszer', 'Location', 'northeast', 'Orientation', 'vertical'); + +set(gcf, 'position', [0 0 h_width height]); +if save_plot + saveas(gcf,'Sim_diff_aperture_field',file_format); +end + +%% Sim_characteristics_far_field + +[x1, y1] = rtx1.plotFarField(); +[x2, y2] = rtx2.plotFarField(); +close all; + +plot(x1, y1, 'b',... + x2, y2, 'r', 'LineWidth', 1.5); +grid on; +title("Cassegrain antenna távoltere"); +legend('1. módszer', '2. módszer', 'Location', 'northeast', 'Orientation', 'vertical'); +xlabel("\Theta [°]"); +ylabel("S_{rel} [dB]"); +ylim([-60 1]); +xlim([-15 15]); + +set(gcf, 'position', [0 0 h_width height]); +if save_plot + saveas(gcf,'Sim_diff_far_field',file_format); +end + +