|
|
@@ -39,34 +39,29 @@
|
|
|
%% You should have received a copy of the GNU General Public License
|
|
|
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
-function [] = sphear_plot_directions(BF, fmin, fmax, ymin, ymax, Fs, Nfft, filename, smooth)
|
|
|
-
|
|
|
- %% no smoothing or plotting by default
|
|
|
- if (!exist("smooth"))
|
|
|
- smooth = 0;
|
|
|
- end
|
|
|
-
|
|
|
+function [] = sphear_plot_directions(BF, fmin, fmax, ymin, ymax, Fs, Nfft, smooth)
|
|
|
f = figure;
|
|
|
hold on;
|
|
|
grid on;
|
|
|
+ %% pbaspect([16, 9, 1]);
|
|
|
axis([fmin, fmax, ymin, ymax]);
|
|
|
tics('y', [9, 6, 3, 0, -3, -6, -9, -12, -15, -20, -25, -30]);
|
|
|
tics('x', [300, 500, 1000, 1500, 2000, 3000, 5000, 7000, 10000, 15000, 20000]);
|
|
|
ca=get (gcf, "currentaxes");
|
|
|
- set(ca,"fontweight","bold","linewidth",1.5);
|
|
|
+ set(ca,"fontweight","bold");
|
|
|
|
|
|
- %% which components to plot for each mocrophone array
|
|
|
+ %% which directions to plot for each microphone array and each componentx
|
|
|
%% 0: do not plot, 1: cardinal plot, 2: diagonal plot
|
|
|
if (size(BF, 2) > 4)
|
|
|
%% octa
|
|
|
%%m_W = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1];
|
|
|
- m_W = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2];
|
|
|
+ m_W = [1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0];
|
|
|
m_X = [1, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0, 0, 0, 2, 0];
|
|
|
m_Y = [0, 0, 2, 0, 1, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0];
|
|
|
m_Z = [1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0];
|
|
|
else
|
|
|
%% tetra
|
|
|
- m_W = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0];
|
|
|
+ m_W = [1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0];
|
|
|
m_X = [1, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0, 0, 0, 2, 0];
|
|
|
m_Y = [0, 0, 2, 0, 1, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0];
|
|
|
m_Z = [1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0];
|
|
|
@@ -76,7 +71,8 @@ function [] = sphear_plot_directions(BF, fmin, fmax, ymin, ymax, Fs, Nfft, filen
|
|
|
%% calculate B format frequency responses
|
|
|
for b = 1:size(BF, 2)
|
|
|
if (smooth > 0)
|
|
|
- bfft(m,b,:) = fastsmooth(10*log10(abs(fft(BF(m, b, :), Nfft))), smooth, 2, 1)(1:end/2);
|
|
|
+ printf("m:%d, c:%d: applying smoothing of %f...\n", m, b, smooth);
|
|
|
+ bfft(m,b,:) = fastsmooth(10*log10(abs(fft(BF(m, b, :), Nfft))), smooth, 3, 1)(1:end/2);
|
|
|
else
|
|
|
bfft(m,b,:) = 10*log10(abs(fft(BF(m, b, :), Nfft)))(1:end/2);
|
|
|
end
|
|
|
@@ -95,39 +91,50 @@ function [] = sphear_plot_directions(BF, fmin, fmax, ymin, ymax, Fs, Nfft, filen
|
|
|
for m = 1:size(BF, 1)
|
|
|
%% W cardinals
|
|
|
if (m_W(m) == 1)
|
|
|
- pW = semilogx(fr, bfft(m,1,:) - fft_avg + W_offset, "k;W;", "linewidth", 1.5);
|
|
|
+ pW = semilogx(fr, bfft(m,1,:) - fft_avg + W_offset, "k-", "linewidth", 1.25);
|
|
|
end
|
|
|
+ end
|
|
|
+ for m = 1:size(BF, 1)
|
|
|
%% W diagonals
|
|
|
if (m_W(m) == 2)
|
|
|
- pWd = semilogx(fr, bfft(m,1,:) - fft_avg + Wd_offset, "k;W;", "linewidth", 1.5, "linestyle", "--");
|
|
|
+ pWd = semilogx(fr, bfft(m,1,:) - fft_avg + Wd_offset, "k--", "linewidth", 1.25);
|
|
|
end
|
|
|
+ end
|
|
|
+ for m = 1:size(BF, 1)
|
|
|
%% X cardinals
|
|
|
if (m_X(m) == 1)
|
|
|
- pXp = semilogx(fr, bfft(m,2,:) - fft_avg + X_offset, "r;X;", "linewidth", 1.5);
|
|
|
+ pXp = semilogx(fr, bfft(m,2,:) - fft_avg + X_offset, "r-", "linewidth", 1.25);
|
|
|
end
|
|
|
+ end
|
|
|
+ for m = 1:size(BF, 1)
|
|
|
%% X diagonals
|
|
|
if (m_X(m) == 2)
|
|
|
- pXd = semilogx(fr, bfft(m,2,:) - fft_avg + X_offset, "r;X;", "linewidth", 1.5, "linestyle", "--");
|
|
|
+ pXd = semilogx(fr, bfft(m,2,:) - fft_avg + X_offset, "r--", "linewidth", 1.25);
|
|
|
end
|
|
|
+ end
|
|
|
+ for m = 1:size(BF, 1)
|
|
|
%% Y cardinals
|
|
|
if (m_Y(m) == 1)
|
|
|
- pYp = semilogx(fr, bfft(m,3,:) - fft_avg + Y_offset, "b;Y;", "linewidth", 1.5);
|
|
|
+ pYp = semilogx(fr, bfft(m,3,:) - fft_avg + Y_offset, "b-", "linewidth", 1.25);
|
|
|
end
|
|
|
+ end
|
|
|
+ for m = 1:size(BF, 1)
|
|
|
+ %% Y diagonals
|
|
|
if (m_Y(m) == 2)
|
|
|
- pYd = semilogx(fr, bfft(m,3,:) - fft_avg + Y_offset, "b;Y;", "linewidth", 1.5, "linestyle", "--");
|
|
|
+ pYd = semilogx(fr, bfft(m,3,:) - fft_avg + Y_offset, "b--", "linewidth", 1.25);
|
|
|
end
|
|
|
end
|
|
|
- l = legend([pW, pXp, pXd, pYp, pYd],
|
|
|
- {sprintf("W principal directions (%.1fdB offset)", W_offset),
|
|
|
- sprintf("X principal directions (%.1fdB offset)", X_offset),
|
|
|
- sprintf("X diagonal directions (%.1fdB offset)", Y_offset),
|
|
|
- sprintf("Y principal directions (%.1fdB offset)", X_offset),
|
|
|
- sprintf("Y diagonal directions (%.1fdB offset)", Y_offset),
|
|
|
+ l = legend([pW, pWd, pXp, pXd, pYp, pYd], ...
|
|
|
+ {sprintf("W principal directions (%.1fdB offset)", W_offset), ...
|
|
|
+ sprintf("W diagonal directions (%.1fdB offset)", W_offset), ...
|
|
|
+ sprintf("X principal directions (%.1fdB offset)", X_offset), ...
|
|
|
+ sprintf("X diagonal directions (%.1fdB offset)", Y_offset), ...
|
|
|
+ sprintf("Y principal directions (%.1fdB offset)", X_offset), ...
|
|
|
+ sprintf("Y diagonal directions (%.1fdB offset)", Y_offset), ...
|
|
|
});
|
|
|
- legend(l, 'location', 'southwest');
|
|
|
- %% print to file if filename specified
|
|
|
- if (exist("filename"))
|
|
|
- print(f, '-deps', '-tight', '-S1920,1080', '-color', ["../figures/b_format_sphear3.eps"]);
|
|
|
- end
|
|
|
+ legend("boxoff");
|
|
|
+ %% legend(l, 'location', 'south');
|
|
|
+ rect = [0.15, 0.15, 0.5, 0.16];
|
|
|
+ set(l, 'position', rect);
|
|
|
end
|
|
|
|