Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
antennaHF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ftomi
antennaHF
Commits
c4310bb3
Commit
c4310bb3
authored
4 years ago
by
frey.balazs96
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://git.sch.bme.hu/ftomi/antennahf
parents
5e73c8b9
c92ce86e
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
RTX class/Antenna.m
+31
-15
31 additions, 15 deletions
RTX class/Antenna.m
RTX class/Ray.m
+0
-34
0 additions, 34 deletions
RTX class/Ray.m
RTX class/Trace.m
+37
-13
37 additions, 13 deletions
RTX class/Trace.m
RTX class/simclass_test.m
+10
-13
10 additions, 13 deletions
RTX class/simclass_test.m
with
78 additions
and
75 deletions
RTX class/Antenna.m
+
31
−
15
View file @
c4310bb3
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
This diff is collapsed.
Click to expand it.
RTX class/Ray.m
+
0
−
34
View file @
c4310bb3
...
...
@@ -10,39 +10,5 @@ classdef Ray
obj.dir = dir;
end
end
function
t
=
trace
(
obj
,
barriers
,
maxCol
)
t
=
Trace
(
obj
);
ncol
=
0
;
for
m
=
1
:
maxCol
col
=
Collision
;
col
.
collided
=
false
;
dist
=
+
Inf
;
col_barrier
=
1
;
for
k
=
1
:
size
(
barriers
,
2
)
c
=
barriers
(
k
)
.
collide
(
t
.
rays
(
ncol
+
1
));
% get collision from the 'k'th barrier
if
(
c
.
collided
)
d
=
Vect
.
abs
(
c
.
pos
-
obj
.
start
);
if
d
<
dist
dist
=
d
;
col
=
c
;
col_barrier
=
k
;
end
end
end
if
col
.
collided
ncol
=
ncol
+
1
;
next_ray
=
Ray
(
col
.
pos
,
col
.
reflDir
);
t
=
t
+
next_ray
;
barriers
(
col_barrier
)
.
post_collide
(
col
);
if
col
.
stop
t
.
trace_end
();
%Nem tudom ez mire való: rays(m+1).dir = Vect;
break
;
end
else
break
;
end
end
end
end
end
This diff is collapsed.
Click to expand it.
RTX class/Trace.m
+
37
−
13
View file @
c4310bb3
classdef Trace
<
handle
properties
id
;
wavelength
;
rays
Ray =
[];
length =
+inf;
init_phase =
0;
...
...
@@ -8,20 +10,42 @@ classdef Trace < handle
end
methods
function
obj =
Trace(rays,
init_phase
)
if
isvector
(
rays
)
obj.rays =
rays;
return
else
obj.rays(1) =
rays;
end
if
nargin =
=
2
function
obj =
Trace(id,
init_ray
,
init_phase
,
wavelength
,
barriers
,
maxCol
)
obj.id =
id;
obj.rays(1) =
init_ray;
obj.init_phase =
init_phase;
obj.wavelength =
wavelength;
ncol =
0;
for
m =
1:maxCol
col =
Collision;
col.collided =
false;
dist =
+Inf;
col_barrier =
1;
for
k =
1:size(barriers,2)
c =
barriers(k).collide(obj.rays(ncol+1));
%
get
collision
from
the
'
k
'
th
barrier
if
(
c.collided
)
d =
Vect.abs(c.pos
-
init_ray.start
);
if
d
<
dist
dist =
d;
col =
c;
col_barrier =
k;
end
end
end
if
col.collided
ncol =
ncol
+
1;
next_ray =
Ray(col.pos,
col.reflDir
);
obj.rays
(
end
+1
) =
next_ray;
barriers
(
col_barrier
).
post_collide
(
col
);
if
col.stop
obj.trace_end
();
break
;
end
else
break
;
end
end
function
p =
plus(t,r)
p =
Trace([t.rays
r
],
t.init_phase
);
end
function
length =
trace_end(obj)
...
...
This diff is collapsed.
Click to expand it.
RTX class/simclass_test.m
+
10
−
13
View file @
c4310bb3
...
...
@@ -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
t
=
rays
(
k
)
.
trace
(
reflectors
,
5
);
for
k
=
1
:
size
(
rays
,
2
)
t
=
Trace
(
k
,
rays
(
k
),
0
,
wavelength
,
reflectors
,
5
);
%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));
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment