Sign in

username:

password:



Not a member?

Search compdsp



Search tips

comp.dsp by Keywords

Adaptive Filter | ADPCM | ADSP | ADSP-2181 | Aliasing | AMR | Anti-Aliasing | ARMA | Autocorrelation | AutoCovariance | Beamforming | Bessel | Blackfin | Butterworth | C6713 | CCS | Chebyshev | CIC Filter | Circular Convolution | Code Composer Studio | Comb Filter | Compression | Convolution | Cross Correlation | DCT | Decimation | Deconvolution | Demodulation | DM642 | DSP Boards | DSP/BIOS | DTMF | Echo Cancellation | Equalization | Equalizer | ETSI | EZLITE (Ez-kit Lite) | FFT | FFTW | FIR Filter | Fixed Point | FSK | G.711 | G.723 | G.729 | Gaussian Noise | Goertzel | GPIO | Hilbert Transform | IFFT | IIR Filter | Interpolation | Invariance | JTAG | Kalman | Laplace Transform | Levinson | LPC | McBSP | MIPS | Modulation | MPEG | Multirate | Notch Filter | Nyquist | OFDM | Oversampling | Pink Noise | Pitch | PLL | Polyphase | QAM | QDMA | Quantization | Quantizer | Radar | Random Noise | Reed Solomon | Remez | Resampling | RTDX | Sampling | Sharc | TI C6711 | Undersampling | Viterbi | Wavelets | White Noise | Wiener Filter | Windowing | XDS510PP | Z Transform


Discussion Groups

Free Online Books

Discussion Groups | Comp.DSP | DSP, IIR filter C/C++ Code, Need Help

There are 6 messages in this thread.

You are currently looking at messages 0 to 6.


DSP, IIR filter C/C++ Code, Need Help - Deepak - 06:13 24-10-04

Hi,

I am running into a problem, and that is developing a C code for
TMS320C6713 DSP processor. The application requires coding of a
complex valued IIR filter.
The filter equation is:

H(z) = 1/(1+ SUM(i=1:8) (Ai Z^-i))

Hoopefully you can understand the above equation, the SUM is actually
summation sign (SIGMA) and (i= 1:8) is lower and upper limit of the
sigma.
I have precalculated coefficients of the filter (Ai's) and they are
all complex.

Now the design requirement is:

A complex valued signal of gaussian distribution is passes through
this filter. No as C doesn't support gaussian random variates, I have
a standard algorithm to convert the output of Rand() function which
are uniformly distributed, into Gaussian distribution. How do I really
write a C code for this application. I have tried and it doesn't work.
I created a structure of complex type for handling complex math, such
as assigning a complex value, complex add, subtraction and
multiplication.

If anybody is eager to help me out, please respond to this message or
email me at k...@gmail.com    I would even provide better
documentation to make you better understand the problem.

Thank you in advance,
Deepak

Re: DSP, IIR filter C/C++ Code, Need Help - Tim Wescott - 13:08 24-10-04



Deepak wrote:
> Hi,
> 
> I am running into a problem, and that is developing a C code for
> TMS320C6713 DSP processor. The application requires coding of a
> complex valued IIR filter.
> The filter equation is:
> 
> H(z) = 1/(1+ SUM(i=1:8) (Ai Z^-i))
> 
> Hoopefully you can understand the above equation, the SUM is actually
> summation sign (SIGMA) and (i= 1:8) is lower and upper limit of the
> sigma.
> I have precalculated coefficients of the filter (Ai's) and they are
> all complex.
> 
> Now the design requirement is:
> 
> A complex valued signal of gaussian distribution is passes through
> this filter. No as C doesn't support gaussian random variates, I have
> a standard algorithm to convert the output of Rand() function which
> are uniformly distributed, into Gaussian distribution. How do I really
> write a C code for this application. I have tried and it doesn't work.
> I created a structure of complex type for handling complex math, such
> as assigning a complex value, complex add, subtraction and
> multiplication.
> 
> If anybody is eager to help me out, please respond to this message or
> email me at k...@gmail.com    I would even provide better
> documentation to make you better understand the problem.
> 
> Thank you in advance,
> Deepak

See section 3 of 
http://www.wescottdesign.com/articles/zTransform/z-transforms.html -- it 
shows how to make a filter from a transfer function.  Translating this 
to complex coefficients should be trivial.

Two notes:

One: You _do not_ want to use a direct-form filter!  You'll want to 
factor your polynomial and make a cascade of eight first-order filters 
-- the article explains why.

Two: The C++ standard math library includes a complex type.  Assuming 
that you can use C++ and that TI has followed the standard for your 
processor you should use it.  Otherwise a set of C code will do OK, at 
the cost of less readable code.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Re: DSP, IIR filter C/C++ Code, Need Help - Jerry Avins - 13:30 24-10-04

Tim Wescott wrote:

> ...  You'll want to
> factor your polynomial and make a cascade of eight first-order filters

How does one get complex ans zeros poles with first-order sections?

Jerry
-- 
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Re: DSP, IIR filter C/C++ Code, Need Help - Jerry Avins - 13:49 24-10-04

Jerry Avins wrote:

> Tim Wescott wrote:
> 
> 
>>...  You'll want to
>>factor your polynomial and make a cascade of eight first-order filters
> 
> 
> How does one get complex ans zeros poles with first-order sections?
> 
> Jerry
I wrote that?!!!

How does one get complex poles and zeros with first-order sections?
-- 
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Re: DSP, IIR filter C/C++ Code, Need Help - Carlos Moreno - 15:57 24-10-04

Jerry Avins wrote:

>>>...  You'll want to
>>>factor your polynomial and make a cascade of eight first-order filters
>>
>>How does one get complex ans zeros poles with first-order sections?
>>
>>Jerry
> 
> I wrote that?!!!

Well, I didn't want to go rub it on your face, but since
you brought it up......  ;-)

Carlos
--

Re: DSP, IIR filter C/C++ Code, Need Help - Tim Wescott - 23:00 24-10-04

Jerry Avins wrote:

> Tim Wescott wrote:
> 
> 
>>...  You'll want to
>>factor your polynomial and make a cascade of eight first-order filters
> 
> 
> How does one get complex ans zeros poles with first-order sections?
> 
> Jerry

Jerry:

Y'know, I was assuming that since he has a complex input signal that his 
poles were not matched up into nice tidy conjugate pairs -- which may or 
may not be the case.

At any rate, if you allow complex arithmetic you get a complex pole in a 
1st-order section by having a transfer function 1/(z-d) with d complex. 
  It requires nearly as much computation as a 2nd-order transfer 
function with a conjugate pair and it requires a complex math type but 
it does allow you to do computations with non-conjugate poles.

Ahh, assumptions, assumptions.

Deepak:

Is your transfer function strictly real valued, with only complex data 
to process, or are the A_i complex as well?  If all of the A_i are 
real-valued then you'll want to process the real and imaginary parts of 
your input separately (but with the same transfer function), and make 
your filter as a cascade of 1st- and 2nd-order fully-real valued 
transfer functions.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com