Hi all, I'm designing a filter FIR. I looked for the coefficients with FDATOOL. But to implement this filter I have to multiply this coefficients with a binary input (12 bits) but the coefficients aren't binary code. Can I convert them to a binary format? Thanks,
coefficients filter FIR
Started by ●February 21, 2009
Reply by ●February 21, 20092009-02-21
chriselba wrote:> Hi all, > > I'm designing a filter FIR. I looked for the coefficients with FDATOOL. > But to implement this filter I have to multiply this coefficients with a > binary input (12 bits) but the coefficients aren't binary code. Can I > convert them to a binary format?You will need to be a little clearer about what you have. In a modern computers, all numbers, even text characters, are represented in binary. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●February 22, 20092009-02-22
A filter FIR is implemented with the following expression: y = x(n)·b(n) + x(n-1).b(n-1) + x(n-2)·b(n-2)+........+x(0)·b(0) where: vector x(n) is a binary input (12 bits). x(n) is a current input, while x(n-1) is the input delayed 1 sample. This input comes to a initial conversion analog to digital. vector b(n) indicates the value of coefficients. I've found this coefficients using FDATOOL from Matlab. But matlab gives me this coefficients with a real format but I need a binary format, so it's impossible multiply a real number and a binary code. Sorry for my english.
Reply by ●February 22, 20092009-02-22
"chriselba" <ehp4987@hotmail.com> writes:> A filter FIR is implemented with the following expression: > > y = x(n)·b(n) + x(n-1).b(n-1) + x(n-2)·b(n-2)+........+x(0)·b(0) > > where: > > vector x(n) is a binary input (12 bits). x(n) is a current input, while > > x(n-1) is the input delayed 1 sample. This input comes to a initial > conversion analog to digital. > > vector b(n) indicates the value of coefficients. I've found this > coefficients using FDATOOL from Matlab. But matlab gives me this > coefficients with a real formatExactly what format is that? There are several common formats for representing numbers on a computer: 1. unsigned binary 2. signed two's complement 3. 32-bit IEEE-754 floating point 4. 64-bit IEEE-754 floating point There is no "real" format that I know of.> but I need a binary format, so it's impossible multiply a real number > and a binary code.What binary format do you need? As Jerry has already pointed out, we need to know more about your computing scenario, i.e., what hardware are you using (a PC? a Cray? an FPGA?) and, if a computer, what language (Matlab? C?, Python?)? -- % Randy Yates % "And all that I can do %% Fuquay-Varina, NC % is say I'm sorry, %%% 919-577-9882 % that's the way it goes..." %%%% <yates@ieee.org> % Getting To The Point', *Balance of Power*, ELO http://www.digitalsignallabs.com
Reply by ●February 22, 20092009-02-22
Randy Yates <yates@ieee.org> writes:> "chriselba" <ehp4987@hotmail.com> writes: > >> A filter FIR is implemented with the following expression: >> >> y = x(n)·b(n) + x(n-1).b(n-1) + x(n-2)·b(n-2)+........+x(0)·b(0) >> >> where: >> >> vector x(n) is a binary input (12 bits). x(n) is a current input, while >> >> x(n-1) is the input delayed 1 sample. This input comes to a initial >> conversion analog to digital. >> >> vector b(n) indicates the value of coefficients. I've found this >> coefficients using FDATOOL from Matlab. But matlab gives me this >> coefficients with a real format > > Exactly what format is that? There are several common formats for > representing numbers on a computer: > > 1. unsigned binary > 2. signed two's complement > 3. 32-bit IEEE-754 floating point > 4. 64-bit IEEE-754 floating point > > There is no "real" format that I know of.Doh! The key word here is "Matlab!" Sorry! OK, so you're going from Matlab (which is essentially 64-bit IEEE floating point) to where? The subsequent question I ask below is thus the relevent question here.>> but I need a binary format, so it's impossible multiply a real number >> and a binary code. > > What binary format do you need? > > As Jerry has already pointed out, we need to know more about your > computing scenario, i.e., what hardware are you using (a PC? a Cray? an > FPGA?) and, if a computer, what language (Matlab? C?, Python?)?-- % Randy Yates % "She has an IQ of 1001, she has a jumpsuit %% Fuquay-Varina, NC % on, and she's also a telephone." %%% 919-577-9882 % %%%% <yates@ieee.org> % 'Yours Truly, 2095', *Time*, ELO http://www.digitalsignallabs.com
Reply by ●February 22, 20092009-02-22
chriselba wrote:> A filter FIR is implemented with the following expression: > > y = x(n)·b(n) + x(n-1).b(n-1) + x(n-2)·b(n-2)+........+x(0)·b(0) > > where: > > vector x(n) is a binary input (12 bits). x(n) is a current input, while > > x(n-1) is the input delayed 1 sample. This input comes to a initial > conversion analog to digital. > > vector b(n) indicates the value of coefficients. I've found this > coefficients using FDATOOL from Matlab. But matlab gives me this > coefficients with a real format but I need a binary format, so it's > impossible multiply a real number and a binary code. > > Sorry for my english.Indeed, the problem is language. Your coefficients are given in floating point, and your data are in two's complement. Both, being represented by ones and zeros, are binary. You need to convert your coefficients from float to int. Matlab can do that, but I don't know that language. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●February 22, 20092009-02-22
Randy Yates wrote:> "chriselba" <ehp4987@hotmail.com> writes:>> ... But matlab gives me this coefficients with a real format > > Exactly what format is that? There are several common formats for > representing numbers on a computer: > > 1. unsigned binary > 2. signed two's complement > 3. 32-bit IEEE-754 floating point > 4. 64-bit IEEE-754 floating point > > There is no "real" format that I know of."Real" is a common euphemism for "float". That's unfortunate. It leads people to thing they are really numbers. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●February 22, 20092009-02-22
Thanks for all answers. Finally I've found my solution. In FDATOOL there are a chance to change the format about the coefficients. This option is in Analysis/Analysis Parameters... Then I can display the coefficients with a decimal (sorry I wanted to say decimal and no real in the last message), hexadecimal or binary format. Other option placed in "Set quantization parameters" allows select the arithmetic of filter (fixed point, single floated point or double floated point). I've selected the single floated point, but the coefficients have 35 bits!!!! Theoretically the coefficients should have only 32 bits: 1 bit about sign. 8 bits about exponent. 23 bits about signficand. What it means the other bits?
Reply by ●February 22, 20092009-02-22
Monkey see, monkey do. chriselba wrote:> Thanks for all answers. > > Finally I've found my solution. In FDATOOL there are a chance to change > the format about the coefficients. This option is in Analysis/Analysis > Parameters... Then I can display the coefficients with a decimal (sorry I > wanted to say decimal and no real in the last message), hexadecimal or > binary format. Other option placed in "Set quantization parameters" allows > select the arithmetic of filter (fixed point, single floated point or > double floated point). I've selected the single floated point, but the > coefficients have 35 bits!!!! > > Theoretically the coefficients should have only 32 bits: > > 1 bit about sign. > 8 bits about exponent. > 23 bits about signficand. > > What it means the other bits?
Reply by ●February 22, 20092009-02-22
If you're using FIR filters *probably* you whould use fixed point arithmetic rather than floating point units. If you'd use fixed point arithmetic probably you should look at Q notation (http://en.wikipedia.org/wiki/Fixed-point_arithmetic)... but it really depends on your coefficients, the fact that you allow some loss of precision (depending on coefficients length) or you have specific area/speed requirements.> >Thanks for all answers. > >Finally I've found my solution. In FDATOOL there are a chance to change >the format about the coefficients. This option is in Analysis/Analysis >Parameters... Then I can display the coefficients with a decimal (sorryI>wanted to say decimal and no real in the last message), hexadecimal or >binary format. Other option placed in "Set quantization parameters"allows>select the arithmetic of filter (fixed point, single floated point or >double floated point). I've selected the single floated point, but the >coefficients have 35 bits!!!! > >Theoretically the coefficients should have only 32 bits: > >1 bit about sign. >8 bits about exponent. >23 bits about signficand. > >What it means the other bits? >






