Normalizes a rational expression to: .. math:: F(s) = gain\\,s^{\\ell} \\frac{1+b_1s + ... + b_ms^m}{1+a_1s + ... + a_ns^n} :param Rational: Rational function of the variable. :type Rational: sympy.Expr :param var: Variable of the rational function :type var: sy
(rational, var=ini.laplace, method='lowest')
| 294 | return (gain, numCoeffs, denCoeffs) |
| 295 | |
| 296 | def normalizeRational(rational, var=ini.laplace, method='lowest'): |
| 297 | """ |
| 298 | Normalizes a rational expression to: |
| 299 | |
| 300 | .. math:: |
| 301 | |
| 302 | F(s) = gain\\,s^{\\ell} \\frac{1+b_1s + ... + b_ms^m}{1+a_1s + ... + a_ns^n} |
| 303 | |
| 304 | :param Rational: Rational function of the variable. |
| 305 | :type Rational: sympy.Expr |
| 306 | |
| 307 | :param var: Variable of the rational function |
| 308 | :type var: sympy.Symbol |
| 309 | |
| 310 | :param method: Normalization method: |
| 311 | |
| 312 | - "highest": the coefficients of the highest order of |
| 313 | <variable> of the denominator will be noramalized to unity. |
| 314 | - "lowest": the coefficients of the lowest order of |
| 315 | <variable> of the denominator will be noramalized to unity. |
| 316 | |
| 317 | :type method: str |
| 318 | |
| 319 | :return: Normalized rational function of the variable. |
| 320 | :rtype: sympy.Expr |
| 321 | """ |
| 322 | gain, numCoeffs, denCoeffs = coeffsTransfer( |
| 323 | rational, var=var, method=method) |
| 324 | if len(numCoeffs) and len(denCoeffs): |
| 325 | numCoeffs = list(reversed(numCoeffs)) |
| 326 | denCoeffs = list(reversed(denCoeffs)) |
| 327 | num = sp.Poly(numCoeffs, var).as_expr() |
| 328 | den = sp.Poly(denCoeffs, var).as_expr() |
| 329 | rational = gain*num/den |
| 330 | return rational |
| 331 | |
| 332 | def _cancelPZ(poles, zeros): |
| 333 | """ |
no test coverage detected