17 constexpr T factor = std::numbers::inv_pi_v<T> / 2;
18 return radps * factor;
21 template<
class T,
int N>
22 Eigen::Vector<T, N>
to_hz(
const Eigen::Vector<T, N>& radps){
23 constexpr T factor = std::numbers::inv_pi_v<T> / 2;
24 return radps * factor;
35 constexpr T factor = 2 * std::numbers::pi_v<T>;
39 template<
class T,
int N>
40 Eigen::Vector<T, N>
to_radps(
const Eigen::Vector<T, N>& hz){
41 constexpr T factor = 2 * std::numbers::pi_v<T>;
47 constexpr T factor =
static_cast<T
>(180) / std::numbers::pi_v<T>;
51 template<
class T,
int N>
52 Eigen::Vector<T, N>
to_deg(
const Eigen::Vector<T, N>& rad){
53 constexpr T factor =
static_cast<T
>(180) / std::numbers::pi_v<T>;
59 constexpr T factor = std::numbers::pi_v<T> /
static_cast<T
>(180);
63 template<
class T,
int N>
64 Eigen::Vector<T, N>
to_rad(
const Eigen::Vector<T, N>& deg){
65 constexpr T factor = std::numbers::pi_v<T> /
static_cast<T
>(180);
71 return 20 * std::log10(value);
76 return std::pow(
static_cast<T
>(10), value /
static_cast<T
>(20));
116 const T result = (
static_cast<T
>(2) / Ts) * std::tan(omega * Ts /
static_cast<T
>(2));
128 template<
class T,
int N>
129 Eigen::Vector<T, N>
prewarp_tustin(
const Eigen::Vector<T, N>& omegas,
const T& Ts){
130 const Eigen::Vector<T, N> result = ((
static_cast<T
>(2) / Ts) * (omegas.array() * Ts /
static_cast<T
>(2)).tan()).matrix();
158 const T result = (
static_cast<T
>(2) / Ts) * std::atan(omega * Ts /
static_cast<T
>(2));
170 template<
class T,
int N>
171 Eigen::Vector<T, N>
unwarp_tustin(
const Eigen::Vector<T, N>& omegas,
const T& Ts){
172 const Eigen::Vector<T, N> result = ((
static_cast<T
>(2) / Ts) * (omegas.array() * Ts /
static_cast<T
>(2)).atan()).matrix();
Bode< T > prewarp_tustin(const Bode< T > &bode, const T &Ts)
Prewarps the frequency axis of a bode plot for tustin discretisation.
Definition Bode.hpp:427
Bode< T > unwarp_tustin(const Bode< T > &bode, const T &Ts)
Unwarps the frequency axis of a bode plot for tustin discretisation.
Definition Bode.hpp:445
The main namespace for the Control++ library.
Definition Bode.cpp:3
T to_hz(const T &radps)
Converts a number from radiants per second to herz.
Definition conversion.hpp:16
T to_radps(const T &hz)
Converts a number from herz to radiants per second.
Definition conversion.hpp:34
T to_rad(const T °)
Definition conversion.hpp:58
T to_dB(const T &value)
Definition conversion.hpp:70
T to_deg(const T &rad)
Definition conversion.hpp:46
T from_dB(const T &value)
Definition conversion.hpp:75