This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <xtensor/xarray.hpp> | |
#include <xtensor/xio.hpp> | |
#include <xtensor/xmath.hpp> | |
#include <xtensor/xsort.hpp> | |
#include <xtensor/xview.hpp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pybind11/pybind11.h> | |
#include <pybind11/stl.h> | |
#include <numpy.hpp> | |
namespace py = pybind11; | |
// Function to parse attributes | |
int parseAttr(const py::object &obj) { | |
if (py::isinstance<py::none>(obj)) { | |
return INT_MAX; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nichols_numerical_data(system, initial_omega=0.01, final_omega=100, **kwargs): | |
""" | |
Returns the numerical data of Nichols plot of the system. | |
It is internally used by ``nichols_plot`` to get the data | |
for plotting Nichols plot. Users can use this data to further | |
analyse the dynamics of the system or plot using a different | |
backend/plotting-module. | |
Parameters | |
========== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _get_breakaway_points(system): | |
"""Private method to calculate the breakaway points of a transfer function.""" | |
k_expr = -system.den/system.num | |
k = diff(k_expr, system.var) | |
points = solve(k, system.var) | |
points = [point.evalf() for point in points if point.is_real] | |
breakaway_points = [] | |
for point in points: | |
if k_expr.subs(system.var, point) > 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@classmethod | |
def from_coeff_lists(cls, coeff_list, var): | |
r""" | |
Creates a new ``TransferFunction`` efficiently from a list of coefficients. | |
Parameters | |
========== | |
coeff_list : List | |
List comprising of numerator and denominator coefficient lists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================================= | |
Solved Textbook Problems using Control Module | |
============================================= | |
Given below, are some comprehensive textbook examples to demonstrate the possible use cases | |
of the Control Module. | |
Example 1 | |
--------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- bode_phase_plot, bode_plot) | |
+ bode_phase_plot, bode_plot, margin_plot, nichols_numerical_data, nichols_plot) | |
__all__ = ['TransferFunction', 'Series', 'MIMOSeries', 'Parallel', | |
'MIMOParallel', 'Feedback', 'MIMOFeedback', 'TransferFunctionMatrix','gbt', | |
@@ -12,4 +12,5 @@ | |
'impulse_response_numerical_data', 'impulse_response_plot', | |
'ramp_response_numerical_data', 'ramp_response_plot', | |
'bode_magnitude_numerical_data', 'bode_phase_numerical_data', | |
- 'bode_magnitude_plot', 'bode_phase_plot', 'bode_plot'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/sympy/physics/control/lti.py | |
+++ b/sympy/physics/control/lti.py | |
@@ -454,6 +454,9 @@ def __new__(cls, num, den, var): | |
if not isinstance(var, Symbol): | |
raise TypeError("Variable input must be a Symbol.") | |
+ if (num.is_polynomial(var) is False or den.is_polynomial(var) is False): | |
+ raise TypeError("Numerator and Denominator of TransferFunction must be a polynomial") | |
+ | |
if den == 0: |