Commit b90fe750 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Great clean-up before merging, now with plots

parent 684e8595
......@@ -5,6 +5,8 @@ if numel( point ) ~= 3
error( 'Point must be of dimension 3' );
end
b = false;
d = point - obj.location;
if norm( d ) < obj.set_get_geo_eps
b = true; % Point is indescriminably close to wedge location
......@@ -12,7 +14,7 @@ else
dir1 = d / norm( d );
d2 = bj.aperture_direction - obj.location;
d2 = obj.aperture_direction;
dir2 = d2 / norm( d2 );
% Point should have same (or opposite) direction as aperture
......
......@@ -24,7 +24,7 @@ end
%% Variables
apex_point = fin_wedge.get_aperture_point( source_pos, receiver_pos );
apex_point = fin_wedge.approx_aperture_point( source_pos, receiver_pos );
apex_dir = fin_wedge.aperture_direction;
ref_face = fin_wedge.point_facing_main_side( source_pos );
theta_S = fin_wedge.get_angle_from_point_to_wedge_face( source_pos, ref_face );
......
......@@ -25,7 +25,7 @@ end
%% Calculation
apex_point = wedge.get_aperture_point( source_pos, receiver_pos );
apex_point = wedge.approx_aperture_point( source_pos, receiver_pos );
r_dir = norm( receiver_pos - source_pos );
detour = norm( apex_point - source_pos ) + norm( receiver_pos - apex_point ) - norm( receiver_pos - source_pos );
lambda = speed_of_sound ./ frequencies;
......
......@@ -18,7 +18,7 @@ if nargin < 6
end
%% Variables
apex_point = wedge.get_aperture_point( source_pos, receiver_pos );
apex_point = wedge.approx_aperture_point( source_pos, receiver_pos );
SA = ( apex_point - source_pos ) ./ norm( apex_point - source_pos );
AR = ( receiver_pos - apex_point ) ./ norm( receiver_pos - apex_point );
detour = norm( apex_point - source_pos ) + norm( receiver_pos - apex_point ) - norm( receiver_pos - source_pos );
......@@ -29,14 +29,14 @@ r_dir = norm( receiver_pos - source_pos );
in_shadow_zone = ita_diffraction_shadow_zone( wedge, source_pos, receiver_pos );
phi = acos( AR, SA ); % angle between receiver and shadow boundary
phi = acos( dot( AR, SA ) ); % angle between receiver and shadow boundary
if phi > pi/4
phi = pi/4;
end
phi_0 = transition_const;
c_norm = 10^(5/20);
c_approx = repmat( 1 + ( c_norm - 1 ) .* exp( -phi/phi_0 ), 1, numel(frequencies) );
c_approx = repmat( 1 + ( c_norm - 1 ) .* exp( -phi/phi_0 ), 1, numel(frequencies) )';
%% Transfer function
if in_shadow_zone
......
......@@ -22,7 +22,7 @@ if ~in_shadow_zone
end
%% Variables
apex_point = wedge.get_aperture_point( source_pos, receiver_pos );
apex_point = wedge.approx_aperture_point( source_pos, receiver_pos );
dir_src_2_apex_pt = ( apex_point - source_pos ) ./ norm( apex_point - source_pos );
dir_apex_pt_2_rcv = ( receiver_pos - apex_point ) ./ norm( receiver_pos - apex_point );
r = norm( apex_point - source_pos ); % Distance Source to Apex point
......
......@@ -32,7 +32,7 @@ alpha_d = linspace( alpha_start, alpha_end, alpha_res );
% Set Receiver Positions
rcv_positions = ita_align_points_around_aperture( wdg, rcv_start_pos, alpha_d, apex_point, ref_face );
rcv_positions = ita_diffraction_align_points_around_aperture( wdg, rcv_start_pos, alpha_d, apex_point, ref_face );
in_shadow_zone = zeros( size(rcv_positions, 1), 1 );
for i = 1:size(rcv_positions, 1)
in_shadow_zone(i) = ita_diffraction_shadow_zone( wdg, src, rcv_positions(i, :) );
......@@ -142,7 +142,7 @@ legend( [num2str( round( f_plot' ) ), str_hz], 'Location', 'southwest' );
xlabel( 'theta_R []' );
ylabel( 'p_{total} [dB]' );
ylim( [-35, 10] );
xlim( [rad2deg(alpha_d(1)), rad2deg(alpha_d(end))] );
xlim( [rad2deg(alpha_d(end)), rad2deg(alpha_d(1))] );
grid on;
subplot( 2, 2, 2 );
......@@ -153,6 +153,6 @@ legend( [num2str( round( f_plot' ) ), str_hz], 'Location', 'southwest' );
xlabel( 'theta_R []' );
ylabel( 'p_{total} [dB]' );
ylim( [-35, 10] );
xlim( [rad2deg(alpha_d(1)), rad2deg(alpha_d(end))] );
xlim( [rad2deg(alpha_d(end)), rad2deg(alpha_d(1))] );
grid on;
......@@ -19,7 +19,7 @@ angle_resolution = 2000;
%% Calculations
ref_face = infw.point_facing_main_side( src );
alpha_d = linspace( infw.get_angle_from_point_to_wedge_face(rcv_start_pos, ref_face), infw.opening_angle, angle_resolution );
rcv_positions = ita_align_points_around_aperture( infw, rcv_start_pos, alpha_d, apex_point, ref_face );
rcv_positions = ita_diffraction_align_points_around_aperture( infw, rcv_start_pos, alpha_d, apex_point, ref_face );
h1_0 = zeros( 1, numel(alpha_d) );
h2_0 = zeros( 1, numel(alpha_d) );
......
......@@ -10,14 +10,14 @@ rcv_start_pos = 15/sqrt(2) * [ 1, 1, 0 ];
rcv_end_pos = 15/sqrt(2) * [ 1, -1, 0 ];
% Set receiver positions alligned around the aperture
apex_point = infScreen.get_aperture_point(src_pos, rcv_start_pos);
apex_point = infScreen.approx_aperture_point(src_pos, rcv_start_pos);
src_is_facing_main_face = infScreen.point_facing_main_side( src_pos );
alpha_start = infScreen.get_angle_from_point_to_wedge_face(rcv_start_pos, src_is_facing_main_face);
alpha_end = infScreen.get_angle_from_point_to_wedge_face(rcv_end_pos, src_is_facing_main_face);
alpha_res = 200;
alpha_d = linspace( alpha_start, alpha_end, alpha_res );
rcv_positions = ita_align_points_around_aperture( infScreen, rcv_start_pos, alpha_d, apex_point, src_is_facing_main_face );
rcv_positions = ita_diffraction_align_points_around_aperture( infScreen, rcv_start_pos, alpha_d, apex_point, src_is_facing_main_face );
rcv_in_shadow_zone = zeros(size(rcv_positions, 1), 1);
for i = 1:size(rcv_positions, 1)
rcv_in_shadow_zone(i) = ita_diffraction_shadow_zone( infScreen, src_pos, rcv_positions(i, :) );
......@@ -85,7 +85,7 @@ legend( legend_freqs, 'Location', 'southwest' );
xlabel( 'theta_R []' );
ylabel( 'p_{total} [dB]' );
ylim( [-35, 10] );
xlim( [rad2deg(alpha_d(1)), rad2deg(alpha_d(end))] );
xlim( [rad2deg(alpha_d(end)), rad2deg(alpha_d(1))] );
grid on
subplot( 2, 1, 2 );
......@@ -95,7 +95,7 @@ legend( legend_freqs, 'Location', 'southwest' );
xlabel( 'theta_R []' );
ylabel( 'p_{total} [dB]' );
ylim( [-35, 10] );
xlim( [rad2deg(alpha_d(1)), rad2deg(alpha_d(end))] );
xlim( [rad2deg(alpha_d(end)), rad2deg(alpha_d(1))] );
grid on
......@@ -15,7 +15,7 @@ transition_constant = 0.1; % Smoothening factor
%% Calculations
% Set receiver positions alligned around the aperture
apex_point = inf_wdg.get_aperture_point(src_pos, rcv_start_pos);
apex_point = inf_wdg.approx_aperture_point(src_pos, rcv_start_pos);
src_is_facing_main_face = inf_wdg.point_facing_main_side( src_pos );
alpha_start = inf_wdg.get_angle_from_point_to_wedge_face(rcv_start_pos, src_is_facing_main_face);
alpha_end = inf_wdg.get_angle_from_point_to_wedge_face(rcv_end_pos, src_is_facing_main_face);
......@@ -79,7 +79,7 @@ legend( legend_freqs, 'Location', 'southwest' );
xlabel( 'theta_R []' );
ylabel( 'p_{total} [dB]' );
ylim( [-35, 10] );
xlim( [rad2deg(alpha_d(1)), rad2deg(alpha_d(end))] );
xlim( [rad2deg(alpha_d(end)), rad2deg(alpha_d(1))] );
grid on
subplot( 2, 1, 2 );
......@@ -89,8 +89,5 @@ legend( legend_freqs, 'Location', 'southwest' );
xlabel( 'theta_R []' );
ylabel( 'p_{total} [dB]' );
ylim( [-35, 10] );
xlim( [rad2deg(alpha_d(1)), rad2deg(alpha_d(end))] );
xlim( [rad2deg(alpha_d(end)), rad2deg(alpha_d(1))] );
grid on
......@@ -6,7 +6,7 @@ src = [-1 0 0];
rcv = [1 1 0];
w = itaInfiniteWedge(n1, n2, loc);
apex_point = w.get_aperture_point(src, rcv);
apex_point = w.approx_aperture_point(src, rcv);
apex_dir = w.aperture_direction;
% freq = [100, 200, 400, 800, 1600, 3200, 6400, 12800, 24000];
......
......@@ -78,7 +78,7 @@ legend( legend_freqs, 'Location', 'southwest' );
xlabel( 'theta_R []' );
ylabel( 'p_{total} [dB]' );
ylim( [-35, 10] );
xlim( [rad2deg(alpha_d(1)), rad2deg(alpha_d(end))] );
xlim( [rad2deg(alpha_d(end)), rad2deg(alpha_d(1))] );
grid on
subplot( 2, 1, 2 );
......@@ -88,7 +88,7 @@ legend( legend_freqs, 'Location', 'southwest' );
xlabel( 'theta_R []' );
ylabel( 'p_{total} [dB]' );
ylim( [-35, 10] );
xlim( [rad2deg(alpha_d(1)), rad2deg(alpha_d(end))] );
xlim( [rad2deg(alpha_d(end)), rad2deg(alpha_d(1))] );
grid on
......
......@@ -6,7 +6,7 @@ source_pos = 5 * [ -1 0 0];
receiver_start_pos = 5 * [ -1 -1 0 ] / sqrt( 2 );
w = itaInfiniteWedge( n1, n2, loc );
apex_point = w.get_aperture_point( source_pos, receiver_start_pos );
apex_point = w.approx_aperture_point( source_pos, receiver_start_pos );
apex_dir = w.aperture_direction;
c = 344; % Speed of sound
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment