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

Modified Antenna, ray generation

parent 69f6081e
Branches
No related tags found
No related merge requests found
classdef Antenna
properties
amplitude = ones(1, 1000);
phase = ones(1, 1000);
phase = zeros(1, 1000);
position Vect;
end
methods
function obj = Antenna(amplitude ,phase)
function obj = Antenna(position, amplitude ,phase)
obj.position = position;
if nargin > 1
obj.amplitude = amplitude;
obj.phase = phase;
end
end
function [rays, complex_amplitudes] = generate_rays(obj, phi)
rays(size(phi, 2)) = Ray;
for k = 1:size(phi, 2)
rays(k) = Ray(obj.position, [cos(phi(k)), sin(phi(k))]);
end
complex_amplitudes = obj.get_complex_amplitudes(phi);
end
function plot_characteristics(obj)
phi = linspace(0,2*pi,1000);
polarplot(phi, obj.amplitude, phi, obj.phase);
end
function complex_amplitude = get_ray_data(obj, phi)
function plot_antenna(obj)
plot(obj.position.x, obj.position.y, 'kO', 'MarkerSize', 10);
end
end
methods(Access = protected)
function complex_amplitudes = get_complex_amplitudes(obj, phi)
n = size(phi, 2);
rpower = zeros(1, n-1);
rphase = zeros(1, n-1);
......@@ -25,8 +47,8 @@ classdef Antenna
dphi = 2 * pi / size(obj.amplitude, 2);
for j = 1:n-1
[m, start_index] = min(abs(data_phi - phi(j)));
[m, stop_index] = min(abs(data_phi - phi(j+1)));
[~, start_index] = min(abs(data_phi - phi(j)));
[~, stop_index] = min(abs(data_phi - phi(j+1)));
for k = start_index:stop_index
if j ~= 1 && k == start_index
continue;
......@@ -35,13 +57,7 @@ classdef Antenna
end
rphase(j) = obj.phase(ceil((start_index + stop_index) / 2));
end
complex_amplitude = rpower.*exp(1i*rphase);
end
function plot(obj)
phi = linspace(0,2*pi,1000);
polarplot(phi, obj.amplitude, phi, obj.phase);
complex_amplitudes = rpower.*exp(1i*rphase);
end
end
end
......@@ -3,24 +3,22 @@ reflectors(end+1) = PlaneReflector([2 0], 2);
reflectors(end+1) = ParabolaReflector([0 0], 4, 3);
reflectors(end+1) = BalazsAperture([3 0], 20, 1000);
start = Vect(1, 0);
n_ray = 10000;
phi_start = -pi;%angle(1-1i);
phi_stop = pi;%angle(1+1i);
phi = linspace(phi_start, phi_stop, n_ray);
rays(n_ray) = Ray;
for k = 1:size(phi, 2)
rays(k) = Ray(start, [cos(phi(k)), sin(phi(k))]);
end
phi_start = -pi;
phi_stop = pi;
n = 1000;
wavelength = 3e8/1e9;
antenna = Antenna(Vect(1,0));
[rays, complex_amplitudes] = antenna.generate_rays(linspace(phi_start, phi_stop, n));
figure(1);
plot(0, 0);
hold on;
for k = 1:n_ray
for k = 1:size(rays, 2)
t = Trace(k, rays(k), 0, wavelength, reflectors, 5);
t.plot_trace();
%t.plot_trace();
end
plot(start.x, start.y, 'kO', 'MarkerSize', 10);
antenna.plot_antenna();
for k = 1:size(reflectors, 2)
reflectors(k).plot_self;
end
......@@ -37,4 +35,3 @@ plot(histogram);
%field = field/max(field);
%plot(20*log10(field));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment