From 4d14f332bce38ebdecaf53d4c9b5cf6edec85fd6 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 17 Nov 2019 23:45:50 +0100 Subject: [PATCH] Projector: fixed DOA calculation --- sdrbase/dsp/projector.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sdrbase/dsp/projector.cpp b/sdrbase/dsp/projector.cpp index f8403b6c3..afe98ad5a 100644 --- a/sdrbase/dsp/projector.cpp +++ b/sdrbase/dsp/projector.cpp @@ -70,18 +70,21 @@ Real Projector::run(const Sample& s) } break; case ProjectionPhase: - v = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; + v = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; // normalize break; case ProjectionDOAP: { - Real p = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; // calculate phase. Assume phase difference between - v = acos(p) / M_PI; // two sources at half wavelength distance with sources axis as reference (positive side) + // calculate phase. Assume phase difference between two sources at half wavelength distance with sources axis as reference (positive side) + // cos(theta) = phi / 2*pi*k + Real p = std::atan2((float) s.m_imag, (float) s.m_real); // do not mormalize phi (phi in -pi..+pi) + v = acos(p/M_PI) / M_PI; // normalize theta } break; case ProjectionDOAN: { - Real p = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; // calculate phase. Assume phase difference between - v = -(acos(p) / M_PI); // two sources at half wavelength distance with sources axis as reference (negative source) + // calculate phase. Assume phase difference between two sources at half wavelength distance with sources axis as reference (negative source) + Real p = std::atan2((float) s.m_imag, (float) s.m_real); // do not mormalize phi (phi in -pi..+pi) + v = -acos(p/M_PI) / M_PI; // normalize theta } break; case ProjectionDPhase: @@ -223,5 +226,3 @@ Real Projector::normalizeAngle(Real angle) } return angle; } - -