|
@@ -4,17 +4,20 @@
|
|
|
%% sphear_a2b_all: calculate A2B matrixes for frequency ranges
|
|
%% sphear_a2b_all: calculate A2B matrixes for frequency ranges
|
|
|
%%
|
|
%%
|
|
|
%% usage:
|
|
%% usage:
|
|
|
-%% [F FE A2BF] = sphear_a2b_all(m, fmin, fmax, Noct, Fs, Nsamp, Npre, plt)
|
|
|
|
|
|
|
+%% [F FE A2BF Fs] = sphear_a2b_all(m, fmin, fmax, Noct, Nsamp, Npre, plot_on)
|
|
|
%%
|
|
%%
|
|
|
%% m: vector of measurement numbers to take into account
|
|
%% m: vector of measurement numbers to take into account
|
|
|
%% fmin, fmax: lower and upper frequency limits
|
|
%% fmin, fmax: lower and upper frequency limits
|
|
|
%% Noct: width of frequency ranges in fractions of an octave, this
|
|
%% Noct: width of frequency ranges in fractions of an octave, this
|
|
|
%% will be changed slightly so that the frequency range is
|
|
%% will be changed slightly so that the frequency range is
|
|
|
%% covered by equally spaced frequency bands
|
|
%% covered by equally spaced frequency bands
|
|
|
-%% Fs: sampling rate
|
|
|
|
|
-%% Nsamp: time domain samples to use
|
|
|
|
|
|
|
+%% Nsamp: total number of time domain samples to use
|
|
|
%% Npre: samples to use before the main impulse peak
|
|
%% Npre: samples to use before the main impulse peak
|
|
|
%%
|
|
%%
|
|
|
|
|
+%% optional parameters:
|
|
|
|
|
+%%
|
|
|
|
|
+%% dplot: plot polar response for each frequency band (default is 0)
|
|
|
|
|
+%%
|
|
|
%% Copyright 2016, Fernando Lopez-Lezcano, All Rights Reserved
|
|
%% Copyright 2016, Fernando Lopez-Lezcano, All Rights Reserved
|
|
|
%% nando@ccrma.stanford.edu
|
|
%% nando@ccrma.stanford.edu
|
|
|
%%
|
|
%%
|
|
@@ -31,7 +34,12 @@
|
|
|
%% You should have received a copy of the GNU General Public License
|
|
%% You should have received a copy of the GNU General Public License
|
|
|
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
-function [F FE A2BF PVF] = sphear_a2b_all(m, fmin, fmax, Noct, Fs, Nsamp, Npre, plt)
|
|
|
|
|
|
|
+function [F FE Fs A2BF PVF] = sphear_a2b_all(m, fmin, fmax, Noct, Nsamp, Npre, plot_on)
|
|
|
|
|
+
|
|
|
|
|
+ %% do not plot by default
|
|
|
|
|
+ if (!exist("plot_on"))
|
|
|
|
|
+ plot_on = 0;
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
A2BF = zeros(1, 4, 4);
|
|
A2BF = zeros(1, 4, 4);
|
|
|
|
|
|
|
@@ -48,21 +56,21 @@ function [F FE A2BF PVF] = sphear_a2b_all(m, fmin, fmax, Noct, Fs, Nsamp, Npre,
|
|
|
fe = fmin * 2.^((0:n)/N)';
|
|
fe = fmin * 2.^((0:n)/N)';
|
|
|
|
|
|
|
|
for i = (1:size(fc))
|
|
for i = (1:size(fc))
|
|
|
- R = sphear_af_power(m, fe(i), fe(i + 1), Nsamp, Npre, 1.1);
|
|
|
|
|
|
|
+ [R srate] = sphear_af_power(m, fe(i), fe(i + 1), Nsamp, Npre, 1.1);
|
|
|
[A2B pv max_err] = A2B_matrix(R);
|
|
[A2B pv max_err] = A2B_matrix(R);
|
|
|
- %% measurement, b format component, capsule
|
|
|
|
|
A2BF(i,:,:) = A2B;
|
|
A2BF(i,:,:) = A2B;
|
|
|
PVF(i,:,:) = pv;
|
|
PVF(i,:,:) = pv;
|
|
|
BF = R * A2B;
|
|
BF = R * A2B;
|
|
|
|
|
|
|
|
- printf("%d: %d -> [%d %d] cond=%f\n", i, fc(i), fe(i), fe(i + 1), cond(A2B));
|
|
|
|
|
|
|
+ printf("%2d: %5d -> [%5d %5d] A2B cond=%f\n", i, fc(i), fe(i), fe(i + 1), cond(A2B));
|
|
|
|
|
|
|
|
- if plt
|
|
|
|
|
|
|
+ if plot_on
|
|
|
sphear_bf_plot(BF, fe(i), fe(i + 1), 1.1);
|
|
sphear_bf_plot(BF, fe(i), fe(i + 1), 1.1);
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
F = fc;
|
|
F = fc;
|
|
|
FE = fe;
|
|
FE = fe;
|
|
|
|
|
+ Fs = srate;
|
|
|
end
|
|
end
|
|
|
|
|
|