-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_echo_level_along_line.m
41 lines (33 loc) · 1.16 KB
/
get_echo_level_along_line.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function echo_level = get_echo_level_along_line(A,sm_len,I,r_proj,dl)
% INPUT
% A beamformed results
% sm_len length of smoothing for plotting
% I total 1D of env_sm after flattened
% OUTPUT
% echo_level echo level along the input line
%
% Wu-Jung Lee | [email protected]
% Get envelope and smooth/subsample
env = nan(size(A.data.beam_mf_in_time));
env_sm = nan(size(env));
for iA=1:size(env,2)
env(:,iA) = abs(hilbert(A.data.beam_mf_in_time(:,iA)));
if sm_len==1
env_sm(:,iA) = env(:,iA);
else
env_sm(:,iA) = smooth(env(:,iA),sm_len);
end
end
env_sm = env_sm(1:sm_len:end,:);
A.data.range_beam_sm = A.data.range_beam(1:sm_len:end);
% Compensate for echo level
total_gain_crd_coh = A.param.gain_load -...
A.param.gain_sys -...
A.param.gain_beamform -...
A.param.gain_pc;
TL_comp = repmat(30*log10(A.data.range_beam_sm)',...
1,size(env_sm,2));
env_final = 20*log10(env_sm)+total_gain_crd_coh-3+TL_comp;
env_final = env_final(:);
% Get echo level through 2D interpolation
echo_level = interp1(r_proj,env_final(I),dl.r_vec,'linear','extrap');