mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
reverting wrong change
This commit is contained in:
parent
2a6381c6fa
commit
df6996f3b1
@ -73,20 +73,16 @@ float cn0_svn_estimator(gr_complex* Prompt_buffer, int length, long fs_in, doubl
|
|||||||
float SNR_dB_Hz = 0;
|
float SNR_dB_Hz = 0;
|
||||||
float Psig = 0;
|
float Psig = 0;
|
||||||
float Ptot = 0;
|
float Ptot = 0;
|
||||||
float Psig2, Ptot2, SNR_dB_Hz2; Psig2=0; Ptot2=0;
|
|
||||||
for (int i=0; i<length; i++)
|
for (int i=0; i<length; i++)
|
||||||
{
|
{
|
||||||
Psig += Prompt_buffer[i].real() * Prompt_buffer[i].real(); //std::abs(Prompt_buffer[i].real());
|
Psig += std::abs(Prompt_buffer[i].real());
|
||||||
Psig2 += std::abs(Prompt_buffer[i].real());
|
|
||||||
Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real();
|
Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real();
|
||||||
}
|
}
|
||||||
Psig2 = Psig2 / (float)length;//
|
Psig = Psig / (float)length;
|
||||||
Psig2 = Psig2 * Psig2;//
|
Psig = Psig * Psig;
|
||||||
Ptot2 = Ptot / (float)length;//
|
Ptot = Ptot / (float)length;
|
||||||
SNR = Psig / (Ptot - Psig);
|
SNR = Psig / (Ptot - Psig);
|
||||||
SNR_dB_Hz = 10 * log10(Psig2 / (Ptot2 - Psig2)) + 10 * log10(fs_in/2) - 10 * log10((float)code_length * 1023000 /fs_in ); // 10 * log10(SNR) + 10 * log10(fs_in/2) - 10 * log10((float)code_length);
|
SNR_dB_Hz = 10 * log10(SNR) + 10 * log10(fs_in/2) - 10 * log10((float)code_length);
|
||||||
SNR_dB_Hz2 = 10 * log10(Psig2 / (Ptot2 - Psig2)) + 10 * log10(fs_in/2) - 10 * log10((float)code_length);
|
|
||||||
//std::cout << "CNO = " << SNR_dB_Hz << " old: " << SNR_dB_Hz2 << " code_length: " << code_length << std::endl;
|
|
||||||
return SNR_dB_Hz;
|
return SNR_dB_Hz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user