Skip to content
Snippets Groups Projects
Commit cbed01cf authored by lmaresz's avatar lmaresz
Browse files

Update RTX class/sim_freq.m

parent b49b2b0a
No related branches found
No related tags found
No related merge requests found
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);
aperture = 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;
nRay = 1000;
clear rtx2;
rtx(k) = RTX(reflectors, aperture2, antenna, lambda(k), nRay2);
rtx(k) = RTX(reflectors, aperture, antenna, lambda(k), nRay);
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();
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment