|
@@ -33,7 +33,9 @@
|
|
|
function [RS Fs] = sphear_capsule_power(measurements, fmin, fmax, N, Npre)
|
|
function [RS Fs] = sphear_capsule_power(measurements, fmin, fmax, N, Npre)
|
|
|
pkg load signal;
|
|
pkg load signal;
|
|
|
|
|
|
|
|
- onames = cellstr(['00'; '90']);
|
|
|
|
|
|
|
+ capname = "EM200";
|
|
|
|
|
+
|
|
|
|
|
+ onames = cellstr(['001'; '002']);
|
|
|
|
|
|
|
|
%% all submitted measurements
|
|
%% all submitted measurements
|
|
|
i = 1;
|
|
i = 1;
|
|
@@ -41,9 +43,9 @@ function [RS Fs] = sphear_capsule_power(measurements, fmin, fmax, N, Npre)
|
|
|
%% orientation
|
|
%% orientation
|
|
|
for o = [1, 2]
|
|
for o = [1, 2]
|
|
|
|
|
|
|
|
- printf("%s\n", ["../data/2016.07.26/export/capsule-" sprintf("%02.0f", m) "-" char(onames(o)) "-1.wav"]);
|
|
|
|
|
|
|
+ printf("%s\n", ["../data/current/" capname "/export/capsule-" sprintf("%02.0f", m) "-" char(onames(o)) "-1.wav"]);
|
|
|
|
|
|
|
|
- [capsule, Fs] = wavread(["../data/2016.07.26/export/capsule-" sprintf("%02.0f", m) "-" char(onames(o)) "-1.wav"]);
|
|
|
|
|
|
|
+ [capsule, Fs] = wavread(["../data/current/" capname "/export/capsule-" sprintf("%02.0f", m) "-" char(onames(o)) "-1.wav"]);
|
|
|
|
|
|
|
|
%% indexes in array for frequency bins
|
|
%% indexes in array for frequency bins
|
|
|
imin = round((N/2) * fmin / (Fs/2));
|
|
imin = round((N/2) * fmin / (Fs/2));
|
|
@@ -58,7 +60,7 @@ function [RS Fs] = sphear_capsule_power(measurements, fmin, fmax, N, Npre)
|
|
|
fdom = fft(capsule(range), N);
|
|
fdom = fft(capsule(range), N);
|
|
|
|
|
|
|
|
%% return total power in dB of signal in frequency range
|
|
%% return total power in dB of signal in frequency range
|
|
|
- R(i, o) = 20*log10(sqrt(sum(fdom(imin:imax).*conj(fdom(imin:imax)))/size(fdom(imin:imax),1)));
|
|
|
|
|
|
|
+ R(i, o) = 20*log10(sqrt(sum(fdom(imin:imax).*conj(fdom(imin:imax)))/(imax - imin)));
|
|
|
end
|
|
end
|
|
|
%% add 0 to 90 degree difference in dB (front to side ratio)
|
|
%% add 0 to 90 degree difference in dB (front to side ratio)
|
|
|
R(i, 3) = R(i, 1) - R(i, 2);
|
|
R(i, 3) = R(i, 1) - R(i, 2);
|
|
@@ -74,7 +76,9 @@ function [RS Fs] = sphear_capsule_power(measurements, fmin, fmax, N, Npre)
|
|
|
R(:,1) = R(:,1) - avg;
|
|
R(:,1) = R(:,1) - avg;
|
|
|
R(:,2) = R(:,2) - avg;
|
|
R(:,2) = R(:,2) - avg;
|
|
|
%% sort the results by directivity
|
|
%% sort the results by directivity
|
|
|
- [RS, I] = sort(R'(3,:));
|
|
|
|
|
|
|
+ %% [RS, I] = sort(R'(3,:));
|
|
|
|
|
+ %% sort the results by 0 degree gain
|
|
|
|
|
+ [RS, I] = sort(R'(1,:));
|
|
|
RS = R'(:,I)';
|
|
RS = R'(:,I)';
|
|
|
%% calculate the derivative of directivity
|
|
%% calculate the derivative of directivity
|
|
|
i = 1;
|
|
i = 1;
|