Tool/software: Code Composer Studio
Hi,
In the MRR demo,there is a function convertSNRdBToVar,which is defined as follows:
float convertSNRdBToVar(uint16_t SNRdB,uint16_t bitW, uint16_t n_samples, float resolution)
{
float fVar, RVar;
float scaleFac = (n_samples*resolution);
float resThresh = 2 * resolution * resolution;//question 2
float invSNRlin = antilog2(-SNRdB, bitW) * 2; // We assume our estimator is 3dB worse than the CRLB.
/* CRLB for a frequency estimate */
fVar = (float)invSNRlin * (6.0f/((2.0f*PI_)*(2.0f*PI_))) * recipsp((n_samples*n_samples - 1));
/* Convert to a parameter variance using the scalefactor.*/
RVar = fVar*scaleFac*scaleFac; //question 1
if (RVar < resThresh) //question 3
{
RVar = resThresh;
}
return RVar;
}
1. The variable scaleFac is a scale factor,why is this variable introduced?
2.The variable resThresh is equal to 2 * resolution * resolution, what does that means?
3.After the variable RVar is obtained, why does RVar compare with resThresh?
4.Generally,the conditon RVar < resThresh is almost satisfied in all cases, beacuse according to the formula:
RVar = fVar*scaleFac*scaleFac
=(float)invSNRlin * (6.0f/((2.0f*PI_)*(2.0f*PI_))) * recipsp((n_samples*n_samples - 1))*(n_samples*resolution)*(n_samples*resolution)
=invSNRlin* (3.0f/((2.0f*PI_)*(2.0f*PI_))) * recipsp((n_samples*n_samples - 1))*n_samples*n_samples*(2 * resolution * resolution)
because recipsp((n_samples*n_samples - 1))*n_samples*n_samples≈1:
≈invSNRlin* (3.0f/((2.0f*PI_)*(2.0f*PI_))) *(2 * resolution * resolution)
=invSNRlin* (3.0f/((2.0f*PI_)*(2.0f*PI_))) *resThresh
because invSNRlin<1:
=> RVar <(3.0f/((2.0f*PI_)*(2.0f*PI_))) *resThresh
because (3.0f/((2.0f*PI_)*(2.0f*PI_)))<1:
=> RVar< resThresh
It seems like the CRLB is needless.
Thanks,
Regards,
Rata