```python
import sympy
from sympy import *
import numpy as np
import matplotlib.pyplot as plt
```


```python
class BodePlot():
    
    def __init__(self, string_expr):
        sympy.init_printing()
        s = Symbol('s')
        self.G = sympy.parsing.sympy_parser.parse_expr(string_expr)
        self.tf = lambdify(s, self.G, "numpy")
    
    def plotly(self):
        w = np.logspace(0, 1, 1000)
        H = self.tf(1j * w)
        
        plt.figure(figsize=(10, 5))
        plt.title('ЛАЧХ передаточной функции')
        plt.ylabel('Лог. амплитудно-частотная хар-ка, Дб')
        plt.xlabel('Частота, рад/сек')
        plt.semilogx(w, 20*np.log(np.abs(H)), color="blue", linewidth="1", label=latex(f'${self.G}$'))
        plt.legend(loc=1)
        plt.grid(True)
        plt.show()
        
        plt.figure(figsize=(10, 5))
        plt.title('ЛФЧХ передаточной функции')
        plt.ylabel('Лог. фазочастотная хар-ка, рад')
        plt.xlabel('Частота, рад/сек')
        plt.semilogx(w, np.angle(H, deg=True), color="red", linewidth="1.1", label=latex(f'${self.G}$'))
        plt.legend(loc=1)
        plt.grid(True)
        plt.show()
```


```python
BodePlot('(s**2 + 0.1*s + 7.5)/(s**4 + 0.12*s**3 + 9*s**2)').plotly()
```


```python

```

a0fc0f32481d91c2ec8629b0e91cd736e2562ee9
ipynb
Jupyter Notebook
Untitled1.ipynb
NickGuryan/PolynomialRegression
ac5b02ec1831b85d9782c542e020a123fa160b18
Apache-2.0
Untitled1.ipynb
NickGuryan/PolynomialRegression
ac5b02ec1831b85d9782c542e020a123fa160b18
Apache-2.0
Untitled1.ipynb
NickGuryan/PolynomialRegression
ac5b02ec1831b85d9782c542e020a123fa160b18
Apache-2.0
Qwen/Qwen-72B
1. YES
2. YES