|
@@ -267,17 +267,16 @@ function [A2B XY_gain, UV_gain] = sphear_bf_normalize_gain(A2B, B, FS, fmin, fma
|
|
|
B_power = sphear_signal_power(B, FS, fmin, fmax, fft_size);
|
|
B_power = sphear_signal_power(B, FS, fmin, fmax, fft_size);
|
|
|
%% W, all measurements
|
|
%% W, all measurements
|
|
|
W_avg = mean(B_power(:,1));
|
|
W_avg = mean(B_power(:,1));
|
|
|
- %% XY, first order lobes
|
|
|
|
|
- XY_avg = mean([mean(B_power([1,9],2)), mean(B_power([5, 13], 3))]);
|
|
|
|
|
- if (size(A2B, 1) > 4)
|
|
|
|
|
- %% UV, second order lobes
|
|
|
|
|
- UV_avg = mean([mean(B_power([1,5,9,13],5)), mean(B_power([3,7,11,15], 6))]);
|
|
|
|
|
|
|
+ %% XY, peak of first order lobes
|
|
|
|
|
+ XY_avg = mean([mean(B_power([1,9], 2)), mean(B_power([5, 13], 3))]);
|
|
|
|
|
+ if (size(A2B, 2) > 4)
|
|
|
|
|
+ %% UV, peak of second order lobes
|
|
|
|
|
+ UV_avg = mean([mean(B_power([1,5,9,13], 5)), mean(B_power([3,7,11,15], 6))]);
|
|
|
end
|
|
end
|
|
|
-
|
|
|
|
|
- %% now calculate the gain coefficients and normalize the A2B matrix
|
|
|
|
|
|
|
+ %% calculate the gain coefficients and normalize the A2B matrix
|
|
|
XY_gain = XY_avg/W_avg;
|
|
XY_gain = XY_avg/W_avg;
|
|
|
A2B(:,[2,3,4]) = A2B(:,[2,3,4]) / XY_gain;
|
|
A2B(:,[2,3,4]) = A2B(:,[2,3,4]) / XY_gain;
|
|
|
- if (size(A2B, 1) > 4)
|
|
|
|
|
|
|
+ if (size(A2B, 2) > 4)
|
|
|
UV_gain = UV_avg/W_avg;
|
|
UV_gain = UV_avg/W_avg;
|
|
|
A2B(:,[5,6]) = A2B(:,[5,6]) / UV_gain;
|
|
A2B(:,[5,6]) = A2B(:,[5,6]) / UV_gain;
|
|
|
else
|
|
else
|