Răsfoiți Sursa

calibration: we want to preserve the sign when transforming filter into minimum phase

Fernando Pablo Lopez-Lezcano 8 ani în urmă
părinte
comite
fd645446e9
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      calibration/src/sphear_design_capsule_fir_filters.m

+ 3 - 1
calibration/src/sphear_design_capsule_fir_filters.m

@@ -51,11 +51,13 @@ function [FIR IR MPS] = sphear_design_capsule_fir_filters(F, n, SR, SHAPE)
     %%
     MPS(b,:) = real(ifft(mps(fft(IR(b,:)))));
     %%
+    %% we need to preserve the sign, the minimum phase transformation strips it
+    sgn = sign(IR(b,n/2+1));
     %% create a raised cosine window for the end of the IR
     %% to make sure IR decays to zero (last 8 samples of a 256 sample IR)
     end_window = tukeywin(2 * n, 0.025)(n+1:end);
     %% truncate to original size and window end
-    FIR(b,:) = (MPS(b,:)')(1:n) .* end_window;
+    FIR(b,:) = (MPS(b,:)')(1:n) .* end_window * sgn;
   end
 end