# Partial Fraction Expansion in MATLAB

I am to use MATLAB to find the partial fraction expansion of the following function. Can this be done in that format or do I have to manipulate the function?

Note: This must be done using pure MATLAB only. No add-ons or anything like that. Not even Math Toolbox.

• Short of writing some code to solve for the coefficients of the partial fraction expansion (essentially collecting terms to construct a system of linear equations, then using Matlab to solve the system), I'm not sure there is a "pure Matlab only" approach. Sep 23, 2014 at 0:45

The matlab function residue does the job. For multiplication of the polynomial roots to convert to standard form use conv:

b = 1e4*conv( [1 5], [1 70] );
a = conv( [1 0], conv([1 45], conv([1 55], conv([1 7 110],[1 6 95]) ) ) );

[r, p, k] = residue(b,a);


with r, p and k containing the partial fraction decomposition:

$\frac{b(s)}{a(s)} = k + \sum_i \frac{r_i}{s - p_i}$

check also documentation of the residue function. It is part of the base package and does not need toolboxes.

• I know for sure residue function is for s-domain however if we use it in z-domain it gives our mathematically matched answer but not with z-domain function residuez. Any taker please? Oct 28, 2018 at 5:15
• @Khaaba: residuez computes the partial fraction expansion with respect to variable $z^{-1}$, which is the convention needed in discrete time systems theory. The residue function calculates the partial fraction decomposition in the mathematical sense. It is a matter of convention and residuez can be simulated in terms of residue with some adaption of the input polynomial. Oct 28, 2018 at 14:09
• I got it. I tried myself today morning and what you are saying true. I took time for me understand. Thank you. Oct 29, 2018 at 14:22