Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
908 Views

precision for a cos(x)/sin(x) lookup table

I am thinking to make a table for the calculation of cos(x)/sin(x). I know this could be a very large table if I want the precision to be high. Generally speaking, what is the phase step (x = x+step; x0=0) for making such a table to satisfy the average precision requirement? Thanks.

0 Kudos
4 Replies
Highlighted
Valued Contributor III
3 Views

Re: precision for a cos(x)/sin(x) lookup table

 

--- Quote Start ---  

I am thinking to make a table for the calculation of cos(x)/sin(x). I know this could be a very large table if I want the precision to be high. Generally speaking, what is the phase step (x = x+step; x0=0) for making such a table to satisfy the average precision requirement? Thanks. 

--- Quote End ---  

 

 

To avoid division I will get cos lut and 1/sin lut then multiply cos by 1/sin. 

Precision can be that of amplitude or phase. I think you mean phase precision.  

Phase precision can be designed irrespective of lut size e.g. 2^20 modulo adder. The accumulator result will point to both luts using msbs.
0 Kudos
Highlighted
Valued Contributor III
3 Views

Re: precision for a cos(x)/sin(x) lookup table

 

--- Quote Start ---  

Generally speaking, what is the phase step (x = x+step; x0=0) for making such a table to satisfy the average precision requirement? 

--- Quote End ---  

 

generally speaking, the answer depends completely on application requirements, any precision between e.g. 8 and 24 bit might be appropriate. It's usually a propagation of uncertainty problem, so an exact calculation would derive the cos(x)/sin(x) precision from the impact on final signal processing result. 

 

For medium precision requirements, e.g. 10 or 12 bit table address, ROM resources aren't a problem. Above it, you probably start to think about hybrid methods to save table size. A straightforward method with small footprint is linear table interpolation.
0 Kudos
Highlighted
Valued Contributor III
3 Views

Re: precision for a cos(x)/sin(x) lookup table

 

--- Quote Start ---  

I am thinking to make a table for the calculation of cos(x)/sin(x). I know this could be a very large table if I want the precision to be high. Generally speaking, what is the phase step (x = x+step; x0=0) for making such a table to satisfy the average precision requirement? Thanks. 

--- Quote End ---  

 

 

 

I assumed you meant cos/sin rather than cos & sin. I should say now that cos/sin = cotan and so you can just get cotan directly instead of cos/sin. 

 

if you mean cos & sin then you can use at extreme 1/4 cos lut only then get other 3/4 and sin through logic.
0 Kudos
Highlighted
Valued Contributor III
3 Views

Re: precision for a cos(x)/sin(x) lookup table

 

--- Quote Start ---  

I am thinking to make a table for the calculation of cos(x)/sin(x). I know this could be a very large table if I want the precision to be high. Generally speaking, what is the phase step (x = x+step; x0=0) for making such a table to satisfy the average precision requirement? 

--- Quote End ---  

 

 

There's no hard-and-fast rule that I've found. It's pretty simple to create a MATLAB script that sweeps a tone across a large number of frequencies with your given NCO parameters. The power spectrum of the sinusoid will then show the harmonic level in your sinusoid. The SFDR will either meet your requirements, or it will not, if it does not, you tweak your parameters and re-test. 

 

Here's an m-file I wrote a while back ... it still works, I just ran it in MATLAB. 

 

Cheers, 

Dave
0 Kudos