# Partial Fraction Decomposition in c++

Started by August 25, 2006
```Hello! In order to calculate the Amplitude of a pole of an ARMA filter, I
realise that I have to do a partial fraction decomposition (PFD) of the
ARMA filter transfer function.

The PFD has to be done, so that I can calculate the residuum of the
transfer function at each pole.

I have the transfer function and have calculated the roots of the
numerator and denominator polynomials, but have totally no idea how to
implement the the PFD.

Ive googled quite a bit and found a paper by a Horowitz, Ellis on
algorithms for PFD. I looked at the MATLAB code for a function residue,
but found it too hard to understand.

Could somebody point me to a paper or book where this may be explained? or
is there a library which has this function implemented?

Many thanks once again!

Dilpreet
```
```dilpreet06 wrote:

> Hello! In order to calculate the Amplitude of a pole of an ARMA filter, I
> realise that I have to do a partial fraction decomposition (PFD) of the
> ARMA filter transfer function.
>
> The PFD has to be done, so that I can calculate the residuum of the
> transfer function at each pole.
>
> I have the transfer function and have calculated the roots of the
> numerator and denominator polynomials, but have totally no idea how to
> implement the the PFD.

I'm not quite sure what you mean by "Amplitude of a pole" - but once
you have the roots of the numerator and denominator polynomials, you
have pretty much all the information you can get from this transfer
function (up to a scaling factor). Perhaps you meant the magnitudes of
the poles?

Regards,
Andor

```
```Hi Andor, sorry for the confusion,

What i meant to say was :

I have the polynomial of the transfer function including its roots. From
the roots Ive calculated the frequencies Omega(i) of the (i)th pole, i.e.
where the poles lie.

I want to calculate the magnitude of the transfer function at that pole by
calculating the residuum of the transfer function at the pole. Apparently I
need to multiply the residuum by a scale factor of 20 to get the correct
amplitude. I do not understand why there is a need for a scale factor.
This is why I thought that perhaps i need to decompose the original
transfer function into its partial fractions.

I hope i have been able to explain my problem clearly. Many thanks for

Dilpreet

```
```dilpreet06 wrote:

> Hi Andor, sorry for the confusion,
>
> What i meant to say was :
>
> I have the polynomial of the transfer function including its roots. From
> the roots Ive calculated the frequencies Omega(i) of the (i)th pole, i.e.
> where the poles lie.
>
> I want to calculate the magnitude of the transfer function at that pole by
> calculating the residuum of the transfer function at the pole.

Let's say you have the transfer function H(z) of a stable system. It
has poles (the roots of the denominator), but they are not on the unit
circle (otherwise the system wouldn't be stable). Let's further say the
poles are called p_k. Now of course the magnitude at the poles is
|H(p_k)| = infinity, that's why the are called poles. You know that
without computing the residues.

Or are you interested in the magnitude of the transfer function at the
pole _frequency_? Ie. if

p_k = r_k exp(+/- j w_k),   0 < r_k =/= 1,

you want to know | H(exp(i w_k) |? This is straight forward complex
math, no residues required. Just replace z with exp(j w_k) in the
rational expression and compute the magnitude of the complex number.

Regards,
Andor

```
```Hi Andor, many thanks for your explanation.

Actually I want to know the following :

Each pole of order 2 represents a cosinus / sinus curve right? I want to
know the amplitude of these components, which represent oscillations in
the signal. The residuum method i.e.

Amplitude at the j-th pole = lim (z-z_j) H(z) (z-z_j) was suggested in a
phd thesis.

my question is : what is the difference between the above method and the
method that you suggest?

All i can think of is that in calculating the magnitude |H(ejw)|, the
amplitudes of all the oscillations is taken into account at that
frequency. (but maybe im wrong here).

I hope im not running around in circles, but Im trying to understand what
Im doing here. Thanks once again.
```
```dilpreet06 wrote:

> Hi Andor, many thanks for your explanation.
>
> Actually I want to know the following :
>
> Each pole of order 2 represents a cosinus / sinus curve right? I want to
> know the amplitude of these components, which represent oscillations in
> the signal.

Ah, I see where the problem lies. The short answer is: you cannot find
the amplitude of the sine wave from the AR coefficients - those only
specify exponential damping and frequency. Phase and amplitude must be
got from the signal itself. In other words: two sinusoids with equal
frequency and damping factor produce exactly the same AR (or linear
prediction) coefficients, regardless of phase and amplitude.

> The residuum method i.e.
>
> Amplitude at the j-th pole = lim (z-z_j) H(z) (z-z_j) was suggested in a
> phd thesis.
>
> my question is : what is the difference between the above method and the
> method that you suggest?
>
> All i can think of is that in calculating the magnitude |H(ejw)|, the
> amplitudes of all the oscillations is taken into account at that
> frequency. (but maybe im wrong here).

No, that's correct. However, what you mistakenly think is amplitude is
actually related to the exponential damping factor of the sinusoid. I'm
not sure what kind of information the residue at a pole of a transfer
function gives you.

>
> I hope im not running around in circles, but Im trying to understand what
> Im doing here. Thanks once again.

There's gotta be something out there, but I'm too lazy to look. Maybe I
can post a lengthier reply tomorrow.

Regards,
Andor

```
```>>
>> my question is : what is the difference between the above method and
the
>> method that you suggest?
>>
>> All i can think of is that in calculating the magnitude |H(ejw)|, the
>> amplitudes of all the oscillations is taken into account at that
>> frequency. (but maybe im wrong here).
>
>No, that's correct. However, what you mistakenly think is amplitude is
>actually related to the exponential damping factor of the sinusoid. I'm
>not sure what kind of information the residue at a pole of a transfer
>function gives you.
>

Hi Andor, sorry for the late reply,

I would disagree with you because :

breaking down the Filter Polynomial A(z) into its roots Aroots(z) would
produce three kinds of roots :

-roots of order 2 (conjugate complex) which are responsible for the
sinuisoidal oscillations
-roots of order 1 which are the exponential damping signals
-root of order one with frequency f=0 which is the D.c. value.

or did i understand you wrongly?

Thanks again! :-)
```