diff --git a/RTX class/sim_freq.m b/RTX class/sim_freq.m index 76579a14e3ddf1c201574678ce3aac546a8b0c72..30d17f5bf29536810732f9d30be4f2535c92b227 100644 --- a/RTX class/sim_freq.m +++ b/RTX class/sim_freq.m @@ -1,5 +1,5 @@ -clear -close all +% clear +% close all antPhi = 360/180*pi; antPos = 1;%linspace(0.8, 1.2, 3); @@ -9,50 +9,84 @@ 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(); + aperture = SegmentedAperture([2.0001 0], 20); + antenna = Antenna(Vect(antPos,0), [ones(1,125), zeros(1,750), ones(1,125)], zeros(1,1000)); + nRay = 1000; + rtx(k) = RTX(reflectors, aperture, antenna, lambda(k), nRay); + rtx(k).trace(); + rtx(k).calculateFarField(); dirs(k) = rtx(k).calcDirectivity(); beamWidth(k) = rtx(k).farField.getBeamWidth(); end +%% Plot settings + +plot_width = 1200; +h_width = plot_width * 0.55; +height = 400; +file_format = 'png'; +save_plot = 1; + +%% Sim_freq_1 + kozel = 2*lambda/parabSize/pi*180; figure(3); subplot(2, 1, 1); -scatter(lambda, kozel, 'o'); +scatter(lambda, kozel, 50, 'ok', 'filled'); +title("Cassegrain antenna tulajdonságai a hullámhossz függvényében"); +xlim([0.04 2]) +xlabel("Hullámhossz [m]"); +ylabel("Főnyaláb kúpszöge [°]"); hold on; -scatter(lambda, beamWidth, 'x'); +scatter(lambda, beamWidth, 75, 'xr', 'LineWidth', 1.5); +grid on; +legend('Becsült', 'Szimulált', 'Location', 'southeast', 'Orientation', 'horizontal'); +set(gca,'xscale','log'); + hold off; subplot(2, 1, 2); -scatter(lambda, dirs, 'x'); +scatter(lambda, dirs, 75, 'xr', 'LineWidth', 1.5); +grid on; +xlim([0.04 2]) +xlabel("Hullámhossz [m]"); +ylabel("Irányhatás [dB]"); +set(gca,'xscale','log'); +set(gcf, 'position', [0 0 h_width 1.3*height]); +legend('Szimulált', 'Location', 'northeast', 'Orientation', 'horizontal'); +if save_plot + saveas(gcf,'Sim_freq_1',file_format); +end +%% Sim_freq_2 +close all + +for k = 1:2:length(lambda) +% 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; +end + +figure(2) +title("Cassegrain antenna távoltere a hullámhossz függvényében"); +legend('\lambda = 0.05', '\lambda = 0.2', '\lambda = 1', 'Location', 'northeast'); +set(gcf, 'position', [0 0 h_width height]); +if save_plot + saveas(gcf,'Sim_freq_2',file_format); +end