Simplifying MATLAB fraction to make numerator equal to 1

188 Views Asked by At

I have a function which returns this fraction, which is not in the needed format.

$$\frac{36893488147419103232*z^2}{36893488147419103232*z^2 - 672282507639892864*z + 6656262451880127}$$

I need it to have $1$ at numerator, and I don't need it to be 100% accurate, so it's ok to approximate some terms.

What I did manually was something like this:

$$\frac{36893488147419103232*z^2}{36893488147419103232*z^2 - 672282507639892864*z + 6656262451880127} =$$

\begin{align} \\ & = \frac{(36893488147419103232*z^2)}{(36893488147419103232*z^2)*(1 - \frac{672282507639892864*z}{36893488147419103232*z^2} + \frac{6656262451880127}{36893488147419103232*z^2}} \\ & = \frac{1}{1 - \frac{672282507639892864*z}{36893488147419103232*z^2} + \frac{6656262451880127}{36893488147419103232*z^2}} \\ & \approx \frac{1}{1 - 0.018z^{-1} + 0.0002z^{-2}} \end{align}

which is fine for me.

Now, given the first fraction, is there a way to make this within MATLAB?

Here's a copy & paste friendly version if you need to try something.

(36893488147419103232*z^2)/(36893488147419103232*z^2 - 672282507639892864*z + 6656262451880127)