Forráskód Böngészése

move 2nd order lobe to be an option to the standard cardioid override

Fernando Pablo Lopez-Lezcano 9 éve
szülő
commit
199950be06
1 módosított fájl, 16 hozzáadás és 13 törlés
  1. 16 13
      calibration/src/sphear_calibration_common.m

+ 16 - 13
calibration/src/sphear_calibration_common.m

@@ -63,7 +63,8 @@ end
 %%
 %% Calculate power for signal in a frequency range
 %%
-%% (with an option to replace Z by a forward facing cardioid if the signal is B format)
+%% cardioid == 1: replace Z with a cardioid pointing at horizontal angle "azim"
+%% cardioid == 2: replace Z with a second order lobe pointing at horizontal angle "azim"
 
 function [R] = sphear_signal_power(SIG, FS, fmin, fmax, fft_size, cardioid = 0, azim = 45)
   %% indexes in array for frequency bins
@@ -74,20 +75,22 @@ function [R] = sphear_signal_power(SIG, FS, fmin, fmax, fft_size, cardioid = 0,
   %% calculate power in frequency range
   for m = (1:measurements)
     for s = (1:signals)
-      if (s == 3 && cardioid > 1)
-	spectrum = fft((SIG(m, 1, :) +
-			(1.0 * SIG(m, 2, :) * cos(azim/180*pi)) +
-			(1.0 * SIG(m, 3, :) * sin(azim/180*pi)) +
-			(1.0 * SIG(m, 5, :) * cos((2 * azim)/180*pi)) +
-			(1.0 * SIG(m, 6, :) * sin((2 * azim)/180*pi))) / 2.5, fft_size);
-	%% spectrum = fft(SIG(m, s, :), fft_size);
-      else
-	if (s == 4 && cardioid)
-	  %% spectrum = fft((SIG(m, 1, :) + 1.0 * SIG(m, 2, :)) / 2, fft_size);
-	  spectrum = fft((SIG(m, 1, :) + 1.0 * SIG(m, 2, :) * cos(azim/180*pi) + 1.0 * SIG(m, 3, :) * sin(azim/180*pi)) / 2, fft_size);
+      if (s == 4 && cardioid > 0)
+	if (cardioid < 2)
+	  %% replace Z with a cardioid
+	  spectrum = fft((SIG(m, 1, :) +
+			  1.0 * SIG(m, 2, :) * cos(azim/180*pi) +
+			  1.0 * SIG(m, 3, :) * sin(azim/180*pi)) / 2, fft_size);
 	else
-	  spectrum = fft(SIG(m, s, :), fft_size);
+	  %% replace Z with a second order lobe
+	  spectrum = fft((SIG(m, 1, :) +
+			  (1.0 * SIG(m, 2, :) * cos(azim/180*pi)) +
+			  (1.0 * SIG(m, 3, :) * sin(azim/180*pi)) +
+			  (1.0 * SIG(m, 5, :) * cos((2 * azim)/180*pi)) +
+			  (1.0 * SIG(m, 6, :) * sin((2 * azim)/180*pi))) / 2.5, fft_size);
 	end
+      else
+	spectrum = fft(SIG(m, s, :), fft_size);
       end
       %% return total power of signal in frequency range
       R(m,s,:) = sqrt(sum(spectrum(imin:imax).*conj(spectrum(imin:imax)))/(imax - imin));