I have the following code:
Which results in following for
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?
Best How To :
You can extract the numerator and denominator with
numden, then get their coefficiens with
coeffs, normalize the polynomials, and divide again.
[n,d] = numden(T);
cn = coeffs(n);
cd = coeffs(d);
T = (n/cn(end))/(d/cd(end));
The output of
latex(T) (note: no
simplifyFraction now; it would undo things):
Of course this isn't equal to your fraction, since I in effect multiplied it by
cd(end)/cn(end). Depending on your purposes, you can either
- keep the constant coefficient
cn(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.