Q format

Started by June 22, 2006
```I am kind of new to DSP stuff....i want to convert 1/211 in to Q
format. Can any one tell me how to find it. And I need to find the
quantization error in general for any number how do i do tha???

Thanks,
Rohini.

```
```rohini wrote:
> I am kind of new to DSP stuff....i want to convert 1/211 in to Q
> format. Can any one tell me how to find it. And I need to find the
> quantization error in general for any number how do i do tha???
>
> Thanks,
> Rohini.
>

Say you've got an n-bit number, such that i bits are the integer portion
and q bits are the "quotient" or fraction portion (i.e. i+q=n).

Now say x is the number you're trying to convert to fixed-point and x'
is the fixed-point representation.

x' = round(x * 2^q)

quantization error = x - ( x' / 2^q )

So take your example of x=1/211.  Let's say you're dealing with 16-bit
numbers and you've decided to do q14 math.  That means your total range
is [-2,2) and your precision is 2^-14 (~6.1e-5).

x' = round(1/211 * 2^(-14)
= round(77.649)
= 78
= 0x004E

In binary this means you are representing 1/211 as 00.00 0000 0100 1110

You can now convert this back to decimal by doing 78 / 2^14 =
0.0047607421875.  Therefore your quantization error is:

Eq = 1/211 - 78 / 2^14
= -2.14e-5

I hope that helps you with q-math!  I tried to make it general so you
could apply it anywhere.
The text contains a question about converting a fraction to Q format and finding the quantization error, followed by a detailed answer explaining the process.
single_question_with_answer
Given a text passage, determine:
    1. If it contains a mathematical question (including word problems or calculations)
    2. If an answer to that mathematical question is provided in the text

First, describe the content structure you found in 1-2 sentences.

Then provide your analysis in the following format:
TYPE: <one of the following values>
- NO_QUESTION
- SINGLE_QUESTION
- SINGLE_QUESTION_WITH_ANSWER
- MULTIPLE_QUESTIONS
- MULTIPLE_QUESTIONS_WITH_ANSWERS
system
Q format

Started by June 22, 2006
```I am kind of new to DSP stuff....i want to convert 1/211 in to Q
format. Can any one tell me how to find it. And I need to find the
quantization error in general for any number how do i do tha???

Thanks,
Rohini.

```
```rohini wrote:
> I am kind of new to DSP stuff....i want to convert 1/211 in to Q
> format. Can any one tell me how to find it. And I need to find the
> quantization error in general for any number how do i do tha???
>
> Thanks,
> Rohini.
>

Say you've got an n-bit number, such that i bits are the integer portion
and q bits are the "quotient" or fraction portion (i.e. i+q=n).

Now say x is the number you're trying to convert to fixed-point and x'
is the fixed-point representation.

x' = round(x * 2^q)

quantization error = x - ( x' / 2^q )

So take your example of x=1/211.  Let's say you're dealing with 16-bit
numbers and you've decided to do q14 math.  That means your total range
is [-2,2) and your precision is 2^-14 (~6.1e-5).

x' = round(1/211 * 2^(-14)
= round(77.649)
= 78
= 0x004E

In binary this means you are representing 1/211 as 00.00 0000 0100 1110

You can now convert this back to decimal by doing 78 / 2^14 =
0.0047607421875.  Therefore your quantization error is:

Eq = 1/211 - 78 / 2^14
= -2.14e-5

I hope that helps you with q-math!  I tried to make it general so you
could apply it anywhere.
user
The text contains a question about converting a fraction to Q format and finding the quantization error, followed by a detailed answer explaining the process.

TYPE: SINGLE_QUESTION_WITH_ANSWER