I have the following code:
syms z
Gc=1.582*(1-0.3679*z^-1)/(1+.418*z^-1);
Ghp=.3679*(z^-1)*(1+.718*z^-1)/((1-z^-1)*(1-.3679*z^-1));
T=(Gc*Ghp)/(1+Gc*Ghp);
clipboard('copy', latex(simplifyFraction(T)));
Which results in following for T
:
How can I normalise coefficients? I.e. I want the z2 in denominator and z in numerator to have the coefficient of 1. Is there any function in Matlab to do so?
You can extract the numerator and denominator with
numden
, then get their coefficiens withcoeffs
, normalize the polynomials, and divide again.The output of
latex(T)
(note: nosimplifyFraction
now; it would undo things):If you prefer coefficients in decimal form, use
vpa(T)
: here islatex(vpa(T))
.Of course the above isn't equal to your original fraction, since I in effect multiplied it by
cd(end)/cn(end)
. Depending on your purposes, you can eithercn(end)/cd(end)
separately in your computation, or(cn(end)/cd(end))*((n/cn(end))/(d/cd(end)));
to put it back in. Unfortunately, Matlab is too eager to combine the two fractions into one, but you can still see the normalized polynomials.