1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-28 15:56:33 -04:00

Projector: fixed DOA calculation

This commit is contained in:
f4exb 2019-11-17 23:45:50 +01:00
parent d1b80524ea
commit 4d14f332bc

View File

@ -70,18 +70,21 @@ Real Projector::run(const Sample& s)
} }
break; break;
case ProjectionPhase: 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; break;
case ProjectionDOAP: case ProjectionDOAP:
{ {
Real p = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; // calculate phase. Assume phase difference between // calculate phase. Assume phase difference between two sources at half wavelength distance with sources axis as reference (positive side)
v = acos(p) / M_PI; // 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; break;
case ProjectionDOAN: case ProjectionDOAN:
{ {
Real p = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; // calculate phase. Assume phase difference between // calculate phase. Assume phase difference between two sources at half wavelength distance with sources axis as reference (negative source)
v = -(acos(p) / M_PI); // 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; break;
case ProjectionDPhase: case ProjectionDPhase:
@ -223,5 +226,3 @@ Real Projector::normalizeAngle(Real angle)
} }
return angle; return angle;
} }