Commit 80ca1369 authored by jonasstienen's avatar jonasstienen
Browse files

Improving plot export of diffraction max-order fadeout approach

parent 159d6424
......@@ -21,12 +21,12 @@ a = w.apex_point( s1, r );
ad = w.edge_direction;
c = 344; % speed of sound
f = [ 20, 50, 100, 200, 400, 800, 1600, 3200, 6400, 12800, 24000 ]';
f_legend = { '20 Hz', '50 Hz', '100 Hz', '200 Hz', '400 Hz', '800 Hz', ...
'1.6 kHz', '3.2 kHz', '6.4 kHz', '12.8 kHz', '24 kHz' };
%f = [ 20, 50, 100, 200, 400, 800, 1600, 3200, 6400, 12800, 24000 ]';
%f_legend = { '20 Hz', '50 Hz', '100 Hz', '200 Hz', '400 Hz', '800 Hz', ...
%'1.6 kHz', '3.2 kHz', '6.4 kHz', '12.8 kHz', '24 kHz' };
%f = [ 20, 50, 100, 200, 400 ]';
%f_legend = { '20 Hz', '50 Hz', '100 Hz', '200 Hz', '400 Hz' };
f = [ 50, 500, 5000 ]';
f_legend = { '50 Hz', '500 Hz', '5000 Hz' };
num_angles = 1000;
alpha_d_start = 0;
......@@ -74,56 +74,115 @@ for n = 1 : N
% zero and first order components
H = H_d; % Total sound field ... diffracted component always present
H_0 = H_d; % Total sound field ... diffracted component always present
if ~ita_diffraction_shadow_zone( w, s, r )
H = H + H_i;
H_0 = H_0 + H_i;
end
if ita_diffraction_reflection_zone( w, s, r, false ) % opposite face reflection
H = H + H_r;
H_0 = H_0 + H_r;
end
H_1 = H_d_1;
H_1_no_2 = H_d_1; % Missing 2d order reflection component
if ~ita_diffraction_shadow_zone( w, s, r3 )
H_1 = H_1 + H_i_1;
H_1_no_2 = H_1_no_2 + H_i_1;
end
if ita_diffraction_reflection_zone( w, s, r3, false ) % opposite face reflection
H_1 = H_1 + H_r_1;
end
H_1_half = zeros( numel( H_d_1 ), 1 );
H_1_half_dfo = zeros( numel( H_d_1 ), 1 );
if ita_diffraction_shadow_zone( w, s, r3 )
H_1_half = H_d_1; % Shadow zone yes diffraction only
H_1_half_dfo = H_d_1; % Shadow zone yes diffraction only
else
H_1_half = H_i_1; % Direct sound yes
H_1_half_dfo = H_i_1; % Direct sound yes
if ~ita_diffraction_reflection_zone( w, s, r3, false )
if ita_diffraction_utd_illumination_sign( w, s, r3, false ) == -1
sf = ita_diffraction_utd_illumination_fadeout( w, s, r3, false );
H_1_half = H_1_half + sf .* H_d_1; % closer to shadow zone diffraction yes
H_1_half_dfo = H_1_half_dfo + sf .* H_d_1; % closer to shadow zone diffraction yes
end
else
humbug = 1;
end
end
att_sum = res_data_template;
att_sum.freqData = ( H_1_half ) ./ H_i; % Insertion loss
att_sum_2o = res_data_template;
att_sum_2o.freqData = ( H_0 + H_1 ) ./ H_i;
if n == 1
att_sum_all_2o = att_sum_2o;
else
att_sum_all_2o = ita_merge( att_sum_all_2o, att_sum_2o );
end
att_sum_2o_cut = res_data_template;
att_sum_2o_cut.freqData = ( H_0 + H_1_no_2 ) ./ H_i; % TF w/o 2. order refletion
if n == 1
att_sum_all = att_sum;
att_sum_all_2o_cut = att_sum_2o_cut;
else
att_sum_all = ita_merge( att_sum_all, att_sum );
att_sum_all_2o_cut = ita_merge( att_sum_all_2o_cut, att_sum_2o_cut );
end
att_sum_dfo = res_data_template;
att_sum_dfo.freqData = ( H_1_half_dfo ) ./ H_i; % Diffraction fade-out
if n == 1
att_sum_all_dfo = att_sum_dfo;
else
att_sum_all_dfo = ita_merge( att_sum_all_dfo, att_sum_dfo );
end
att_sum_1ho = res_data_template;
att_sum_1ho.freqData = ( H_0 + H_1_half_dfo ) ./ H_i; % TF w/o 2. order reflection and fade-out
if n == 1
att_sum_all_1ho = att_sum_1ho;
else
att_sum_all_1ho = ita_merge( att_sum_all_1ho, att_sum_1ho );
end
end
%% Plot 1
psize_cm = [ 16*1 9*0.6 ];
% First order
fg1o = figure( 'units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on' );
h = plot( rad2deg( alpha_d ), flip( att_sum_all_2o.freqData_dB', 2 ) );
title( 'TF / DS: ground reflection with 2nd order reflection' )
xlabel( 'alpha_d / degree' )
ylabel( 'dB' )
lgd = legend( flip( f_legend ), 'Location', 'southwest' );
lgd.NumColumns = 3;
xlim( [ -5 185 ] );
ylim( [ -35 10 ] );
grid on;
lw = linspace( 0.5, 2.5, numel( f ));
for i=1:numel( f )
h( i ).LineWidth = lw( i );
end
set( fg1o, 'papersize', psize_cm, 'units', 'centimeters' )
print( 'jst_diss_utd_ground_w_o2_refl', '-fillpage', '-dpdf' )
%% Plot
% Second order
fg = figure( 'units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on' );
fg2o = figure( 'units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on' );
h = plot( rad2deg( alpha_d ), flip( att_sum_all.freqData_dB', 2 ) );
h = plot( rad2deg( alpha_d ), flip( att_sum_all_2o_cut.freqData_dB', 2 ) );
title( 'Transfer function nomalized to free-field transmission' )
title( 'TF / DS: ground reflection w/o 2nd order reflection' )
xlabel( 'alpha_d / degree' )
ylabel( 'dB' )
......@@ -139,8 +198,56 @@ for i=1:numel( f )
h( i ).LineWidth = lw( i );
end
set( fg2o, 'papersize', psize_cm, 'units', 'centimeters' )
print( 'jst_diss_utd_ground_wo_o2_refl', '-fillpage', '-dpdf' )
%% Export
% Diffraction contribution w/o reflection component of diffraction method
fgfdo = figure( 'units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on' );
h = plot( rad2deg( alpha_d ), flip( att_sum_all_dfo.freqData_dB', 2 ) );
title( 'TF / DS: diffraction component SB-RB fade-out' )
xlabel( 'alpha_d / degree' )
ylabel( 'dB' )
lgd = legend( flip( f_legend ), 'Location', 'southwest' );
lgd.NumColumns = 3;
xlim( [ -5 185 ] );
ylim( [ -35 10 ] );
grid on;
lw = linspace( 0.5, 2.5, numel( f ));
for i=1:numel( f )
h( i ).LineWidth = lw( i );
end
set( fgfdo, 'papersize', psize_cm, 'units', 'centimeters' )
print( 'jst_diss_utd_ground_no_2o_refl_fade_out', '-fillpage', '-dpdf' )
% 1st order w/o reflection component of diffraction method
fg1ho = figure( 'units', 'normalized', 'outerposition', [0 0 1 1], 'visible', 'on' );
h = plot( rad2deg( alpha_d ), flip( att_sum_all_1ho.freqData_dB', 2 ) );
title( 'TF / DS: ground reflection with SB-RB fade-out' )
xlabel( 'alpha_d / degree' )
ylabel( 'dB' )
lgd = legend( flip( f_legend ), 'Location', 'southwest' );
lgd.NumColumns = 3;
xlim( [ -5 185 ] );
ylim( [ -35 10 ] );
grid on;
lw = linspace( 0.5, 2.5, numel( f ));
for i=1:numel( f )
h( i ).LineWidth = lw( i );
end
set( fg, 'papersize', [ 16*1.5 9*1.5 ], 'units', 'centimeters' )
print( 'ita_diffraction_plot_utd_total_field_stienen_diss_with_ground', '-fillpage', '-dpdf' )
set( fg1ho, 'papersize', psize_cm, 'units', 'centimeters' )
print( 'jst_diss_utd_ground_w_o1h_refl_fade_out', '-fillpage', '-dpdf' )
Markdown is supported
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